GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Send overall job status in init-post status report by angelapwen · Pull Request #2097 · github/codeql-action

Conversation

@angelapwen

@angelapwen angelapwen commented Jan 24, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR sends a job_status field in the init-post status report so that we will be able to more accurately measure our SLOs (see internal backlinked issue for more).

To populate this field, the change:

  • sets the job status environment variable to Failure or ConfigurationError the first time an error has been established. This is already checked for in the getActionsStatus method that is called when we establish status of each individual action, so we additionally set the environment variable at this time.
  • in the init-post Action, if the ANALYZE_DID_COMPLETE_SUCCESSFULLY environment variable was not true, and the job status environment variable was not already set, we set it to ConfigurationError. This catches the case shown in the submit SARIF after failure PR check, where the failure occurs within the job but outside of the Action steps where we send status reports. We consider this a configuration error for the purposes of telemetry as these steps are not owned by the Action.
  • We also explicitly set the environment variable to Success if ANALYZE_DID_COMPLETE_SUCCESSFULLY is true. Note that in the case where analyze was successful, but some step between analyze and the init-post action fails, we'll incorrectly mark the job status as Success. Presumably this is a very uncommon scenario though 🤔
  • sends the value of this environment variable, or Unknown if not previously populated, to the init-post status report.

At each step, if the environment variable already has a value, we never override it.

I logged the job status in a debug statement to confirm that the appropriate statuses are being sent as expected:

  • Success: successful run log
  • Failure: debug artifacts failure run (failure in analyze step) log
  • Configuration Error: submit SARIF after run (failure occurs in step where we do not send a status report) log

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
angelapwen added 3 commits January 24, 2024 11:18
@angelapwen
Send overall job status in init-post status report
dbd8ad5
@angelapwen
Also set job status to failure if analyze didn't succeed
42cc9a3
@angelapwen
Set job status to success if analyze succeeded
0af1cd9
@angelapwen
angelapwen marked this pull request as ready for review January 24, 2024 12:51
@angelapwen
angelapwen requested a review from a team as a code owner January 24, 2024 12:51
angelapwen added 2 commits January 24, 2024 13:52
@angelapwen
Remove debug print statement
8b31be2
@angelapwen
Consider unsuccessful analysis in non-Action step config error
dd51ee0
@angelapwen
angelapwen force-pushed the send-job-status branch from 2059487 to dd51ee0 Compare January 24, 2024 14:13
@angelapwen
angelapwen requested a review from nickfyson January 24, 2024 14:35
angelapwen added 2 commits January 24, 2024 15:39
@angelapwen
Print debug statement
2dd6a5b
@angelapwen
Remove print statement again
da42b5b
henrymercer
henrymercer reviewed Jan 24, 2024
View reviewed changes

@henrymercer henrymercer left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 thoughts:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/environment.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/status-report.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/init-action-post-helper.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/init-action-post.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@henrymercer

henrymercer commented Jan 24, 2024

Copy link
Copy Markdown
Contributor
  • We also explicitly set the environment variable to Success if ANALYZE_DID_COMPLETE_SUCCESSFULLY is true. Note that in the case where analyze was successful, but some step between analyze and the init-post action fails, we'll incorrectly mark the job status as Success. Presumably this is a very uncommon scenario though 🤔

Just to check my understanding here, if one of the Actions we maintain is called after we successfully uploaded a SARIF file and it fails, then this will set the job status environment variable, so we'll have a failure. If a third-party Action is called after we successfully uploaded a SARIF file, then we won't know about that so we'll mark this as a success. This seems fine as code scanning has succeeded in that situation at analyzing the repo and uploading the analysis results.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

angelapwen and others added 2 commits January 25, 2024 11:29
@angelapwen
Address PR review comments
7daa052
@angelapwen @henrymercer
Update comment
757ff40
Co-authored-by: Henry Mercer <[email protected]>
@angelapwen

angelapwen commented Jan 25, 2024

Copy link
Copy Markdown
Contributor Author

Just to check my understanding here, if one of the Actions we maintain is called after we successfully uploaded a SARIF file and it fails, then this will set the job status environment variable, so we'll have a failure. If a third-party Action is called after we successfully uploaded a SARIF file, then we won't know about that so we'll mark this as a success. This seems fine as code scanning has succeeded in that situation at analyzing the repo and uploading the analysis results.

Yes!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

henrymercer
henrymercer previously approved these changes Jan 25, 2024
View reviewed changes

@henrymercer henrymercer left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nice!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/environment.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/init-action-post-helper.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/status-report.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen @henrymercer
Update documentation
c97e81c
Co-authored-by: Henry Mercer <[email protected]>
@angelapwen
angelapwen dismissed henrymercer’s stale review via c97e81c January 25, 2024 11:00
angelapwen added 6 commits January 25, 2024 12:00
@angelapwen
Set job failure if action aborted
d1c63dc
@angelapwen
Update transpiled files
14205b0
@angelapwen
Group conditions
8f47a57
@angelapwen
Appease linter
0429e3d
@angelapwen
Actually call getFinalJobStatus()
f0dbc07
@angelapwen
Remove unused imports
c2df72d
@angelapwen

angelapwen commented Jan 25, 2024

Copy link
Copy Markdown
Contributor Author

Will hold on merging this until the monolith PR is approved and merged.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

henrymercer
henrymercer previously approved these changes Jan 25, 2024
View reviewed changes
Comment thread src/status-report.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen
angelapwen dismissed henrymercer’s stale review via f05e32e January 25, 2024 15:24
@angelapwen @henrymercer
Update comment on aborted
f05e32e
Co-authored-by: Henry Mercer <[email protected]>
@henrymercer henrymercer added the Rebuild Re-transpile JS & re-generate workflows label Jan 25, 2024
@henrymercer

henrymercer commented Jan 25, 2024

Copy link
Copy Markdown
Contributor

Ah, rebuild doesn't have permission to write to forks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen

angelapwen commented Jan 25, 2024

Copy link
Copy Markdown
Contributor Author

The failures are actually unrelated upstream API failures. The comment change doesn't affect the transpilation files (I think)

henrymercer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

henrymercer
henrymercer approved these changes Jan 25, 2024
View reviewed changes
@henrymercer henrymercer removed the Rebuild Re-transpile JS & re-generate workflows label Jan 25, 2024
@angelapwen

angelapwen commented Jan 26, 2024

Copy link
Copy Markdown
Contributor Author

Monolith PR is merged so I'll merge this now and keep an eye on our telemetry to make sure the change is looking okay!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen
angelapwen merged commit 61bf025 into github:main Jan 26, 2024
This was referenced Jan 26, 2024
Merge main into releases/v3 #2099
Merged
Merge releases/v3 into releases/v2 #2102
Merged
@angelapwen
angelapwen deleted the send-job-status branch January 26, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@henrymercer henrymercer henrymercer approved these changes
@nickfyson nickfyson Awaiting requested review from nickfyson

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@angelapwen @henrymercer
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.