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 the checkout_path for getting the commit oid #956

Merged
merged 4 commits into from
Mar 25, 2022

Conversation

aeisenberg
Copy link
Contributor

@aeisenberg aeisenberg commented Feb 28, 2022

Ensure that repos checked out in a non-standard location can still be uploaded.

Here is a sample PR in a different repo that uses the checkout_path: https://github.com/aeisenberg/actions-test2/pull/4/checks

I created an integration test that validates that checkout_path is doing what it should. Looking at the logs, I can see that the test is doing the right thing, but I'm not able to get the test to fail when checkout_path is not set. So, this still needs a bit of work. Ideally, we would upload the sarif file and verify that the commit_oid is correct, but our tests cannot actually upload any sarif, so that makes checking a little bit harder.

EDIT: I think I have it. See the new integration test.

When running in test mode, payloads will not be uploaded. Instead, they
will be saved to disk so that they can be inspected later.

This change will also require a documentation fix.

I'm not entirely happy with this since to get this working, the init action requires a source-path input and the analyze action requires a checkout_path. But we can specify this in the doc changes.

Fixes #952

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.

@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch 5 times, most recently from d4d4a0a to 471d7af Compare February 28, 2022 21:22
@aeisenberg aeisenberg marked this pull request as ready for review February 28, 2022 22:41
@aeisenberg aeisenberg requested a review from a team as a code owner February 28, 2022 22:41
@aeisenberg aeisenberg marked this pull request as draft February 28, 2022 22:42
@aeisenberg
Copy link
Contributor Author

Still trying to figure out how to verify that the integration test is passing (other than by visually inspecting the log). We need to validate that the commitOid of the payload that would have been invoked is the same as that of the second checkout. One possibility is that I can change the determineMergeBaseCommitOid and getCommitOid methods to write a file to disk with the payload parameters if the action is in debug mode. And the test can validate these parameters after the upload step.

@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch 2 times, most recently from b8a2c1e to 9acab1b Compare March 1, 2022 06:15
@aeisenberg aeisenberg marked this pull request as ready for review March 1, 2022 06:15
@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch from 9acab1b to d7473a8 Compare March 1, 2022 16:07
This commit also adds a new integration check to verify this.

When running in test mode, payloads will not be uploaded. Instead, they
will be saved to disk so that they can be inspected later.
@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch from d7473a8 to a92e877 Compare March 1, 2022 20:41
@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch 6 times, most recently from 72d4e07 to 98e84df Compare March 2, 2022 17:22
source-path: x/y/z/some-path/tests/multi-language-repo
debug: true
- name: Build code (non-windows)
shell:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional? Similarly for Build code (windows).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm...it should be bash. Here and below.

debug: true
- name: Build code (non-windows)
shell:
if: ${{ !startsWith(matrix.os, 'windows-') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. That's true. It's cleaner to use runner.os. I'll make the change.

Copy link
Contributor Author

@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.

Thanks for your review!

source-path: x/y/z/some-path/tests/multi-language-repo
debug: true
- name: Build code (non-windows)
shell:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm...it should be bash. Here and below.

debug: true
- name: Build code (non-windows)
shell:
if: ${{ !startsWith(matrix.os, 'windows-') }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. That's true. It's cleaner to use runner.os. I'll make the change.

@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch from 98e84df to 6591114 Compare March 4, 2022 20:12
@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch 4 times, most recently from a4e7f9e to 852be69 Compare March 10, 2022 22:35
@aeisenberg
Copy link
Contributor Author

Fixes #944

@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch from 852be69 to 5d444c1 Compare March 25, 2022 17:01
@aeisenberg aeisenberg force-pushed the aeisenberg/checkout-path-commitoid branch from 5d444c1 to 88db5e7 Compare March 25, 2022 17:32
@aeisenberg
Copy link
Contributor Author

@criemen I fixed the hang we were seeing by changing from java to csharp for with-checkout-path.yml. Not happy with that, and maybe we should take a deeper look into this.

@aeisenberg
Copy link
Contributor Author

Merging this PR since the previously hanging integration tests are unrelated.

@aeisenberg aeisenberg merged commit 6d1f0a0 into main Mar 25, 2022
@aeisenberg aeisenberg deleted the aeisenberg/checkout-path-commitoid branch March 25, 2022 18:03
This was referenced Mar 30, 2022
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.

upload-sarif action seems to always use GITHUB_WORKSPACE Git information to compute commit_oid
2 participants