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

Submit SARIF for failed runs too #1393

Merged
merged 23 commits into from
Dec 2, 2022
Merged

Conversation

henrymercer
Copy link
Contributor

@henrymercer henrymercer commented Nov 23, 2022

This PR helps us better surface failed code scanning workflow runs by attempting to submit a SARIF file containing executionSuccessful: false in some of these cases. We take special care to ensure that we respect SARIF categories and upload: false options to avoid stale tips. This is made more difficult by the fact that these are only passed to the analyze Action. We want to handle cases where the workflow fails before the analyze step, and we don't have access to these inputs in the post-init step. Therefore we resort to a best-effort attempt at working out what the inputs were based on the workflow file and the variables we do have access to in the post-init step.

We don't to cover every case where the workflow fails here. Cases where the workflow run is cancelled or times out won't be possible to handle — we'd need a different mechanism to notify Code Scanning about these. However this PR will cover many of the cases where workflows fail so we can start providing a better experience.

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.

@henrymercer henrymercer marked this pull request as ready for review November 25, 2022 18:25
@henrymercer henrymercer requested a review from a team as a code owner November 25, 2022 18:25
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.

Partial review only.

CHANGELOG.md Outdated Show resolved Hide resolved
pr-checks/checks/submit-sarif-failure.yml Show resolved Hide resolved
src/feature-flags.ts Show resolved Hide resolved
src/init-action-post-helper.ts Show resolved Hide resolved
src/workflow.ts Outdated Show resolved Hide resolved
src/init-action-post-helper.test.ts Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
Base automatically changed from henrymercer/parse-category to main December 1, 2022 18:26
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.

Nice!

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.

2 participants