runner-container-hooks icon indicating copy to clipboard operation
runner-container-hooks copied to clipboard

Add debug trace for library

Open timmjd opened this issue 1 year ago • 1 comments

As a self hosted runner administrator i want so know why my runners are crashing. If this is related to k8s, a stack trace often does help to pin down the origin of the issue.

Therefore, this change does improve the debug capability of the k8s hook implementation by providing a stack trace via the debug output if an exception happend.

Before the change

before

After the change

after

Change summary

The primary change is to enable a correct sourceMap output for the code, so the stack trace will show up the .ts origin with the correct line number of the trace and not some location within the minified / baked index.js.

  • The linkage between the packages/hooklib and the packages/k8s and packages/docker was changed from a JS based include into a TypeScript composite build. To make this happen, the baseUrl & rootUrl required adaptation.
  • The build by using a combination of tsc followed by ncc was replaced with a direct call of ncc due to otherwise the line number reference got lost.
  • There where some type inconsistencies that pop up within the k8s/package.json that appear now due to the linkage is happening now on a typed based linkage. I guess there was also a bug within the mainContainerContextPorts[port.containerPort] assignment.
  • ncc and typescript library update was required due to the used version caused a bug.

timmjd avatar Apr 24 '24 19:04 timmjd

Hey @timmjd,

Thank you so much for the great work you put in to make this change. I will set aside some time this week or next week to go through these changes, but from the glimpse of it, it seems like a very useful addition to the hook!

nikola-jokic avatar May 29 '24 09:05 nikola-jokic