Generate job UUID in start-proxy action - #4049
Conversation
Use in `init` and `setup-codeql` actions
The `start-proxy` step precedes `init` in Default Setup
mario-campos
left a comment
There was a problem hiding this comment.
One nit but otherwise makes sense and LGTM.
| // Create a unique identifier for this run. | ||
| getJobUUID(actionState); |
There was a problem hiding this comment.
Perhaps it would make sense to do this in createStatusReportBase so we don't have to remember to call this in every Action that might run as the first step.
There was a problem hiding this comment.
I was actually thinking about putting it in runInActions since that's intended to be the common entry point for all actions, but that would mean some more work to make that suitable for all actions.
| throw new Error(`Input required and not supplied: ${name}`); | ||
| }, | ||
| getOptionalInput: () => undefined, | ||
| exportVariable: () => {}, |
There was a problem hiding this comment.
This seems like it could be surprising — it'll silently discard all env var writes, while getTestEnv preserves writes.
There was a problem hiding this comment.
Yeah, I agree. I cherry-picked this from a different branch where I was working on adding exportVariable to ActionsEnv and had stalled on what I wanted the test behaviour of exportVariable to be there. I'll have a go at improving this.
There was a problem hiding this comment.
I have pushed a few commits which make the test ActionsEnv backed by an Env and then added a way of asserting that the Env contains particular entries after the main assertion has run.
The
start-proxyaction precedes theinitaction in Default Setup, but a UUID for the analysis is only generated in theinitaction. That means that telemetry from thestart-proxystep is not easy to associate with subsequent steps in the workflow.This PR refactors the existing code that's duplicated across
initandsetup-codeqlinto a function, allows it to retrieve the existing job UUID from the environment, adds tests, and then uses the new function instart-proxy. This ensures that telemetry fromstart-proxyincludes a unique identifier and the same one is used for the rest of the workflow, while workflows that don't usestart-proxyalso still generate one ininit.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist