Use the combined bundle when queries may need other languages' library packs - #4184
Draft
henrymercer wants to merge 5 commits into
Draft
henrymercer wants to merge 5 commits into
henrymercer wants to merge 5 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rary packs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…p-codeql` Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We support custom configuration files that include packs for other languages, for example:
as taken from our PR checks.
If these custom queries live in compiled packs, then the packs ship their own dependencies. However if the custom query is just a path to a QL file, then the dependencies are resolved from a bundle.
This creates an issue with per-language bundles: CodeQL resolves every configured query before selecting the ones for the analyzed language, so a single-language analysis with a configuration like the above will fail. This is evidenced by failures in the "Go: Custom queries" and "Start proxy" PR checks when using per-language bundles.
This PR only selects a per-language bundle when the query configuration known before CodeQL is set up can't reference such queries: there's no configuration file, the
configinput is unset or we're in a dynamic workflow such as default setup, and thequeriesinput andgithub-codeql-extra-queriesrepository property only name built-in query suites. This avoids loading the configuration before setting up CodeQL, at the cost of using the combined bundle for configuration files that only use built-in queries.This PR also modifies
setup-codeqlto always use the combined bundle, since it can't tell whether the queries that a workflow runs with the CLI will need library packs for other languages. The last commit corrects the docs for itslanguagesandanalysis-kindsinputs, which said to also pass them toinit, even thoughinitfails ifsetup-codeqlhas run in the same job.It also disables per-language bundles in the "Export file baseline information" PR check, since a per-language bundle only reports file baseline information for its own language. The second commit moves
defaultSuitesso thatper-language-bundles.tscan use it without an import cycle.Risk assessment
Low risk: The change only affects bundle selection when the
per_language_bundlesfeature flag is enabled.Which use cases does this change impact?
Workflow types:
configinput, or queries that aren't built-in query suites, and workflows that pass a single language tosetup-codeql.Products:
Environments:
How did/will you validate this change?
setup-codeqlAction's entry point has no unit tests, so its reason is only covered indirectly.If something goes wrong after this change is released, what are the mitigation and rollback strategies?
per_language_bundles.How will you know if something goes wrong after this change is released?
initfailures in analyses that use a per-language bundle.Are there any special considerations for merging or releasing this change?
Merge / deployment checklist