| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| * Environment variables to be set by the action and possibly used by the | ||
| * CLI. | ||
| */ | ||
| enum EnvVar { |
There was a problem hiding this comment.
Are all these options only relevant to the action and not to the runner? Just wondering if they should be in actions-util.ts or somewhere shared.
Sorry, something went wrong.
There was a problem hiding this comment.
They should be set by both the action and the runner. (We might need a short word to use about "action and runner both").
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, I've confusingly been using codeql-action to signify both the action and the runner. And actions or runner to signify one mode or the other. (And I've probably not been entirely consistent at that.) If you have better terms, please let me know.
Sorry, something went wrong.
There was a problem hiding this comment.
If there are no better solutions, I'll just make sure to clarify the meaning of all variables, etc in comments.
Sorry, something went wrong.
There was a problem hiding this comment.
Comments are fine by me. My original point was more just that this is in actions-util which was meant to be for code only relating to actions. I'm surprised that when we call setMode/initializeEnvironment from in runner.ts it isn't generating an alert from our custom query.
I think the query might be wrong in fact. I've opened #542
Sorry, something went wrong.
There was a problem hiding this comment.
Ahhh...I see what you mean. I was never clear on the distinction between util.ts and actions-utl.ts. I should probably move the mode-related methods to util.ts.
Sorry, something went wrong.
This PR ensures environment variables are set before any invocation of the CLI. Here is a list of vars that are set: github/codeql-core#1124 (comment) This ensures the CLI knows the features and versions of the containing actions/runner. Additionally: - Fix the user agent so that it more closely aligns with user agent spec - Refactor environment variable initialization so that it all happens in one place and call. - Move Mode, getRequiredEnvParam, setMode, getMode out of actions-util and into util. actions-util is meant for utils only called by the action, not the runner. The `prepareLocalRunEnvironment()` method is most likely deprecated and should be removed. I originally added it because I had a way of working where I would run the action from my local machine to test out changes, but this was always a little flaky. So, I no longer use this way of working. I will probably remove it soon.
This is a functionality that never worked perfectly and hasn't been used for a while. This allows developers to run the action on their local machine, but the run was always flaky and never 100% mirrored what was happening on the actions runner.
|
Oops. A bit of a PR screw-up here. The dependent PR #540 was merged into this one. I also made changes to migrate getMode, setMode, and the env vars from actions-util into util. Can you all take another look? Probably best to go commit-by-commit for this now. |
Sorry, something went wrong.
Must access the env var directly in order to avoid recursive calls to `getRequiredEnvParam`.
There was a problem hiding this comment.
Looks reasonable, though definitely worth another look from Robert.
Sorry, something went wrong.
| } | ||
| core.debug(`${paramName}=${value}`); | ||
|
|
||
| if (process.env[EnvVar.RUN_MODE] === Mode.actions) { |
There was a problem hiding this comment.
Why do we print this here? It looks like it could be left-over debugging code.
Sorry, something went wrong.
There was a problem hiding this comment.
This is just copied from the original method. I can remove in order to simplify things.
Sorry, something went wrong.
There was a problem hiding this comment.
Just copied from earlier. I will remove.
Sorry, something went wrong.
| return value; | ||
| } | ||
|
|
||
| export function getTemporaryDirectory(): string { |
There was a problem hiding this comment.
Should this stay in the actions-only area? The CODEQL_ACTION_TEMP and RUNNER_TEMP variables it looks for only exist on actions. Confusingly, that RUNNER_TEMP is referring to the process that "runs" the actions, and is not related to our codeql-runner.
Sorry, something went wrong.
There was a problem hiding this comment.
Good point. I will move back.
Sorry, something went wrong.
There was a problem hiding this comment.
Moved back to the actions-util.ts module.
Sorry, something went wrong.
|
Generally looks good to me too. I've made a few comments throughout but nothing major. Feel free to merge when you think it's ready. |
Sorry, something went wrong.
Also, move `getTemporaryDirectory` back to `actions-util`.
|
Thanks for the review! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR ensures environment variables are set before any invocation of
the CLI. Here is a list of vars that are set:
https://github.com/github/codeql-coreql-team/issues/1124#issuecomment-852463521
This ensures the CLI knows the features and versions of the containing
actions/runner.
Additionally:
spec
one place and call.
Note that prepareLocalRunEnvironment() should only be run in actions mode.
And the method is most likely deprecated and
should be removed. I originally added it because I had a way of working
where I would run the action from my local machine to test out changes,
but this was always a little flaky. So, I no longer use this way of
working. I will probably remove it soon.
Merge / deployment checklist