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

Cleanup CodeQL DBs and output their location for later steps #543

Merged
merged 1 commit into from Jun 4, 2021

Conversation

edoardopirovano
Copy link
Contributor

This PR does two things that should facilitate user workflows that want to upload CodeQL databases somewhere:

  1. Databases created during the analyze step are cleaned up at the end of the step (i.e. items that are not needed to run further queries like evaluation logs and the cache are removed). The level of cleanup performed is configurable via a new parameter of the analyze step. I don't think we should expose this in user-facing documentation as most users will just want the default, but it may be useful for internal debugging to have an option there.
  2. The analyze step now has an output, db-locations that contains a JSON object mapping from languages that a CodeQL database was created for to the location of this database on disk. I've modified one of the PR checks to use this to verify that it is populated correctly.

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.

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.

Looks good. A couple of suggestions around comments.

@@ -13,6 +13,10 @@ inputs:
description: Upload the SARIF file
required: false
default: "true"
cleanup-level:
description: "Level of cleanup to perform on CodeQL databases at the end of the analyze step. This should either be 'none' to skip cleanup, or be a valid argument for the --mode flag of the CodeQL CLI command 'codeql database cleanup'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice if you could list the valid options here. Or maybe provide a link to the documentation (or both).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm hesitant to list the options because it duplicates where we have to make a documentation change if we modify them later. Have added a link to the CLI docs, though.

analyze/action.yml Outdated Show resolved Hide resolved
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.

👍🏼

@edoardopirovano edoardopirovano merged commit ddb83a4 into github:main Jun 4, 2021
@edoardopirovano edoardopirovano deleted the output-db-location branch June 4, 2021 17:54
@github-actions github-actions bot mentioned this pull request Jun 7, 2021
5 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

2 participants