Skip to content

Upgrade database in coverage report jobs #6180

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

Merged
merged 2 commits into from
Jul 1, 2021

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Jun 29, 2021

The framework coverage jobs download the last released codeql CLI, create a DB, and then run some queries. If the database schema is updated since the release, then the query execution fails. Therefore, this PR adds a codeql database upgrade call to upgrade the created database.

Jobs on main:

Working jobs in dsp-testing based on this PR:

@tamasvajk tamasvajk requested review from yo-h and adityasharad June 29, 2021 11:11
@tamasvajk tamasvajk marked this pull request as ready for review June 29, 2021 11:11
@adityasharad
Copy link
Collaborator

What is the exact error you're seeing from codeql query run? Can you get the stderr logs by running locally?

CodeQL performs "non-destructive" database upgrades automatically when you run a query, which most of the time should avoid the need for a separate upgrade step. Can you also try passing a --search-path to query run instead of adding a separate call to database upgrade?

@tamasvajk
Copy link
Contributor Author

@adityasharad Here's the output:

❯ ./codeql query run /Users/tamasvajk/dev/semmle-code/ql/java/ql/src/meta/frameworks/Coverage.ql --database empty-java --output output-java.csv.bqrs
Compiling query plan for /Users/tamasvajk/dev/semmle-code/ql/java/ql/src/meta/frameworks/Coverage.ql.
Compiling upgrade for /Users/tamasvajk/dev/semmle-code/ql/java/ql/src/meta/frameworks/Coverage.ql
A fatal error occurred: The CodeQL database at empty-java
is not compatible with the QL library ../../../semmle-code/ql/java/ql/src/meta/frameworks/Coverage.ql uses.
The database may be too new for the QL libraries the query is using; try upgrading them.
Alternatively, running 'codeql database upgrade empty-java' with an appropriate --search-path option might help.

Adding --search-path to the query seems to be working too, however being explicit with the upgrade is probably better for future understanding of the code.

@adityasharad
Copy link
Collaborator

I would recommend adding --search-path to the query run and commenting that it's needed to find the upgrades.
(If your query were outside the query repo you would need --search-path anyway, it only works now because it happens to be inside the pack it depends on.)

@tamasvajk
Copy link
Contributor Author

New workflow runs:

@tamasvajk tamasvajk force-pushed the fix/coverage-report-search-path branch from 0dd1e84 to dc63f23 Compare June 30, 2021 11:46
@tamasvajk
Copy link
Contributor Author

@yo-h yo-h merged commit d325d2a into github:main Jul 1, 2021
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.

3 participants