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

Add an option to allow waiting until an analysis has been processed before finishing the Action. #781

Merged
merged 8 commits into from
Nov 18, 2021

Conversation

chrisgavin
Copy link
Contributor

This adds an option to allow waiting until the analysis has succeeded before continuing. This will be used to allow surfacing errors that have occurred while processing the uploaded SARIF file.

When this option is enabled, after uploading the SARIF file the Action will call the status endpoint every 5 seconds until the processing is complete. After 2 minutes, it will give up and continue anyway. I felt that there should be a timeout in case there is some issue with processing and that it shouldn't fail the Action since it's possible the analysis will eventually be processed.

I've not added the option to enable this behavior to the readme, as our hope is to test this out a bit and eventually make it the default at which point we'll remove the option.

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.

@chrisgavin chrisgavin force-pushed the wait-for-processing branch 3 times, most recently from dd9d5e4 to d423c8d Compare October 18, 2021 13:40
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 reasonable to me.

src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@cannist cannist left a comment

Choose a reason for hiding this comment

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

I wonder if we should decouple the check from the actual upload. If we did that we could, for example, upload the codeql database in the analyze action before we start checking the status.

analyze/action.yml Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
chrisgavin and others added 3 commits November 17, 2021 12:14
@chrisgavin chrisgavin force-pushed the wait-for-processing branch 3 times, most recently from 9688a32 to a2b0a22 Compare November 17, 2021 12:30
@chrisgavin chrisgavin marked this pull request as ready for review November 17, 2021 13:02
@chrisgavin chrisgavin requested a review from a team as a code owner November 17, 2021 13:02
Copy link
Contributor

@cannist cannist left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor details.

@@ -52,6 +52,10 @@ inputs:
description: Whether to upload the resulting CodeQL database
required: false
default: "true"
wait-for-processing:
description: If true, the Action will wait for the uploaded SARIF to be processed before completing.
required: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be false since we're providing a default value?

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 believe it being required means it cannot be null, which it won't be if we're providing a default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I always understood required here as "must be specified by the user". If it does not matter if we use true or false in the presence of a default, I think false still is less confusing to the reader.
That would also be in line with the example given in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are also other docs that show the opposite pattern; a required argument with a default value.

I tried in a test repository, and it seems like Actions doesn't really care about whether the value is "required" or not. Possibly it's a planned future feature, but without knowing how it will interpret the property it's hard to say if one way is any better than the other.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, it is your PR. 🙂
I still prefer the other value but if actions do not fall over if the parameter is left unspecified by the user I do not mind too much.

upload-sarif/action.yml Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-lib.ts 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.

Looks reasonable to me, but maybe @cannist should have a look, too.

@chrisgavin chrisgavin merged commit 3e36cdd into main Nov 18, 2021
@chrisgavin chrisgavin deleted the wait-for-processing branch November 18, 2021 12:02
This was referenced Nov 22, 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