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

Always upload DB when in debug mode #860

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

edoardopirovano
Copy link
Contributor

Moves the uploading of the CodeQL DBs produced that we do if debug: true is set into the finally block. This means we will upload the DB even if the analysis fails, which can aid in debugging certain issues (primarily encountered by the Foundations team) where the analysis is failing due to an error in the database.

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.

@edoardopirovano edoardopirovano added the enhancement New feature or request label Dec 30, 2021
@edoardopirovano edoardopirovano requested a review from a team as a code owner December 30, 2021 16:49
Comment on lines 225 to 238
if (config !== undefined && config.debugMode) {
// Upload the database bundles as an Actions artifact for debugging
const toUpload: string[] = [];
for (const language of config.languages) {
toUpload.push(
await bundleDb(config, language, await getCodeQL(config.codeQLCmd))
);
}
await uploadDebugArtifacts(toUpload, config.dbLocation);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to wrap this in a try-catch block itself so if uploading fails, we continue to do the rest of the work below.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also notice that there is both config.debugMode and core.isDebug(). I'm not 100% sure if they are the same. If they are, then this is confusing. If they aren't, then it's still confusing. :) I wonder if we can clean this up (not necessary for this PR, though).

Copy link
Contributor Author

@edoardopirovano edoardopirovano Jan 4, 2022

Choose a reason for hiding this comment

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

Thanks, good point. I've put this it in a try-catch block and with the catch logging the error and then continuing.

Regarding your second comment - indeed those are different things.

I do think we should enable different things based on these flags, but I agree it is a little confusing. I'm not quite sure where in the code it would be appropriate to do this, though. Perhaps we wrap all calls to config.debugMode or core.isDebug() in a helper function and then that helper function can document the difference between the two?

I think this is best left for a follow-up PR, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite sure where in the code it would be appropriate to do this, though. Perhaps we wrap all calls to config.debugMode or core.isDebug() in a helper function and then that helper function can document the difference between the two?

I think that's the best option.

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.

Further refactoring as described above can happen later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants