GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Introduce `CODEQL_ACTION_SKIP_SARIF_UPLOAD` by redsun82 · Pull Request #3180 · github/codeql-action Conversation
Contributor
This triggers a subset of the behavior of This is a fresh take at #3089, with less impact on the codebase. Risk assessmentFor internal use only. Please select the risk level of this change:
Merge / deployment checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis triggers a subset of the behavior of `CODEQL_ACTION_TEST_MODE`, specifically just skipping the SARIF upload step. This is required for our internal testing where we want the SARIF file (via `CODEQL_ACTION_DUMP_SARIF_DIR`) but don't want to actually upload it, but we don't want the rest of the behaviour of `CODEQL_ACTION_TEST_MODE` that is specific for `codeql-action` own CI checks.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pull Request OverviewThis PR introduces a new environment variable Key changes:
Reviewed ChangesCopilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment. Show a summary per file
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Co-authored-by: Copilot <[email protected]>
esbena
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM, but Michael should have the say.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comment is a bit stale now, ditto at the other
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mbg
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, this is generally much neater! I've added a few minor comments. It is probably worth adding a test case for this.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: the wording here isn't great.
Suggested change
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: This no longer explains why the SARIF upload is disabled. A simple fix might be wording it like this:
Suggested change
A better fix would be to include the responsible environment variable, perhaps with:
Suggested change
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
@mbg: how would you go on about this?
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| export function getSarifUploadSkipReason(): string | null { | ||
| if (isInTestMode()) { | ||
| return `SARIF upload is disabled via ${EnvVar.TEST_MODE}`; | ||
| } | ||
| if (process.env[EnvVar.SKIP_SARIF_UPLOAD] === "true") { | ||
| return `SARIF upload is disabled via ${EnvVar.SKIP_SARIF_UPLOAD}`; | ||
| } | ||
| return null; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I had considered something like this when I wrote my comment, but wasn't too keen on it. I also don't love using the human-readable reason phrase to mean true for enablement purposes. The previous version with the boolean function was preferable.
Also, in general, we don't use null in the codeql-action codebase (unless it comes to us from outside the codebase) and would go for undefined here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I was trying to avoid something like
logger.info(`SARIF upload disabled by `${ isInTestMode() ? EnvVar.TEST_MODE : EnvVar.SKIP_SARIF_UPLOAD }`. Saving to ${payloadSaveFile}`);
as I didn't want to expose that util implementation detail. So I think I'll just go with your first proposal for a generic with an environment variable. The users of those variables (us) probably are savvy enough for that to be enough for them.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Hmm yes. Unit tests for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Let's make that into a follow-up PR. I'll try to see what copilot can do there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks like you accidentally reverted one of the changes we wanted to keep. Also two other minor suggestions for wording improvements.
Otherwise this LGTM and I am happy to approve.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| /** | ||
| * Whether to skip uploading SARIF results to GitHub. Intended for testing purposes. | ||
| * This setting is implied by `CODEQL_ACTION_TEST_MODE`, but is more specific. | ||
| * This setting is implied by but is more specific than `CODEQL_ACTION_TEST_MODE`. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to revert this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nope 😅
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ); | ||
| logger.info( | ||
| `In test mode. Results are not uploaded. Saving to ${payloadSaveFile}`, | ||
| `SARIF upload disabled via environment variable. Saving to ${payloadSaveFile}`, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor:
| `SARIF upload disabled via environment variable. Saving to ${payloadSaveFile}`, | |
| `SARIF upload disabled by an environment variable. Saving to ${payloadSaveFile}`, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| core.debug("In test mode. Waiting for processing is disabled."); | ||
| if (shouldSkipSarifUpload()) { | ||
| core.debug( | ||
| "SARIF upload disabled via environment variable. Waiting for processing is disabled.", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| "SARIF upload disabled via environment variable. Waiting for processing is disabled.", | |
| "SARIF upload disabled by an environment variable. Waiting for processing is disabled.", |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing those minor issues!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.