Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toolcache behavior when downloading bundle from another repo #1523

Merged
merged 3 commits into from
Feb 6, 2023

Conversation

henrymercer
Copy link
Contributor

Suppose a user requests a specific version of CodeQL by passing a tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz input to the init Action.

Previously the Action did not take note of the fact the bundle came from dsp-testing/codeql-cli-nightlies, not github/codeql-action. Most of the time, this would mean it wouldn't find a release with the requested tag, and the bundle would be correctly cached as 0.0.0-<bundleVersion> so as to avoid a clash with a stable CodeQL release. However if a release with the same tag existed on the CodeQL Action repository, then the Action would incorrectly associate the CLI version number from that stable bundle with the other bundle, and go on to cache the bundle as <cliVersion>-<bundleVersion>. This led to bundles being cached with the wrong CLI version, for example https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz was cached as 2.12.2, since it matched this release on the github/codeql-action repo.

To resolve this, before we try to look up the CLI version number associated with a particular bundle tag, we check that that bundle originates from github/codeql-action, either the original repository on Dotcom or a synced repository on Enterprise Server.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@henrymercer henrymercer requested a review from a team as a code owner February 6, 2023 16:25
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, but I did want to have a chat with you about URLs and verifying them.

Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍 looks good to me and regression test makes the change quite clear!

(Didn't notice Andrew had already just approved 😅)

Base automatically changed from henrymercer/fix/not-all-bundle-urls-contain-tag to main February 6, 2023 18:20
@henrymercer henrymercer merged commit 927de48 into main Feb 6, 2023
@henrymercer henrymercer deleted the henrymercer/fix/cli-version-for-different-bundles branch February 6, 2023 19:05
@github-actions github-actions bot mentioned this pull request Feb 6, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants