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

Use github merge-results command for merging SARIF files #2199

Merged
merged 14 commits into from
Mar 27, 2024

Conversation

koesie10
Copy link
Member

This will use the github merge-results command when the cli_sarif_merge_enabled feature flag is enabled and all SARIF files were produced by CodeQL.

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.

@koesie10 koesie10 force-pushed the koesie10/cli-sarif-merge branch from a924694 to 66fcc6a Compare March 18, 2024 13:19
@koesie10 koesie10 marked this pull request as ready for review March 20, 2024 14:21
@koesie10 koesie10 requested a review from a team as a code owner March 20, 2024 14:21
@koesie10 koesie10 force-pushed the koesie10/cli-sarif-merge branch from 89a77d5 to e20c273 Compare March 22, 2024 13:15
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

This looks generally great. Some initial comments:

src/codeql.ts Outdated Show resolved Hide resolved
src/codeql.ts Outdated Show resolved Hide resolved
Comment on lines +64 to +65
// This is guarded by a `supportsFeature` check rather than by a version check.
minimumVersion: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Going forwards, this will probably be the common case as we're preferring checking CLI features to checking version numbers. We should consider adding a toolVersion field to this record so callees can just check the feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you suggesting that I add a toolsFeature field to this object in this PR?

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 happy if you'd rather do this in a separate PR, but I think if we rely on checking manually we'll probably make a mistake soon enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if it makes sense for this specific feature flag though since we usually do not have a CodeQL object available in the upload-sarif action, so we wouldn't be able to check the toolsFeature anyway. We probably also don't want to let the future deprecation behavior depend on which version of CodeQL is being used since the deprecation will happen in the Code Scanning API rather than in CodeQL.

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 sure if it makes sense for this specific feature flag though since we usually do not have a CodeQL object available in the upload-sarif action, so we wouldn't be able to check the toolsFeature anyway.

That makes sense — if the feature flag is disabled via the API, there's no point downloading CodeQL.

We probably also don't want to let the future deprecation behavior depend on which version of CodeQL is being used since the deprecation will happen in the Code Scanning API rather than in CodeQL.

I think we'd probably want to time the deprecation such that the CLIs that can't merge SARIF runs are no longer supported by the time we deprecate the API.

src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-lib.ts Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-lib.ts Outdated Show resolved Hide resolved
src/upload-sarif-action-post-helper.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@henrymercer henrymercer 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 to me — just a couple of final comments.

src/upload-sarif-action-post-helper.ts Outdated Show resolved Hide resolved
src/analyze-action-post.ts Outdated Show resolved Hide resolved
Comment on lines +53 to +56
github?: {
"*"?: Options;
"merge-results"?: Options;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for you to fix, but I don't think this addition does anything.

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

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@koesie10 koesie10 merged commit 84ba7fb into main Mar 27, 2024
297 checks passed
@koesie10 koesie10 deleted the koesie10/cli-sarif-merge branch March 27, 2024 13:39
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