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

feat: Support an Impacts All PATH Filter #39

Merged
merged 25 commits into from
Sep 15, 2023
Merged

feat: Support an Impacts All PATH Filter #39

merged 25 commits into from
Sep 15, 2023

Conversation

nikhilbirmiwal
Copy link
Contributor

@nikhilbirmiwal nikhilbirmiwal commented Sep 14, 2023

  • Move the sha computation into prerequisites.
  • If any paths are added/removed/modified via dorny's path filter, skip impacted target computation and upload ALL.

Tested using netkos/act against a temporary merge graph in staging: https://www.loom.com/share/Library-or-Loom-14-September-2023-4edd8ed7f45240718f4180a3543585dc

Closes https://linear.app/trunk/issue/TRUNK-8676/support-wildcard-impacted-target

@nikhilbirmiwal
Copy link
Contributor Author

/trunk merge

@trunk-staging-io
Copy link

✨ Submitted to Merge by Nikhil Birmiwal (@nikhilbirmiwal). It will be added to the graph once all branch protection rules pass and there are no merge conflicts with the target branch. (details)

@@ -10,6 +10,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clone all. git cloning has been moved to the prerequisites step.

@nikhilbirmiwal nikhilbirmiwal marked this pull request as ready for review September 14, 2023 23:35
Copy link
Collaborator

@pv72895 pv72895 left a comment

Choose a reason for hiding this comment

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

Looks great! Nice job. I didn't approve yet since you have the PR queued and I wanted your thoughts on the comment about moving computing the impacted targets (the steps with if: ${{ steps.prerequisites.outputs.impacts_all_detected == 'false' }}) into its own workflow. When ready (whether you choose to do it or not) just request a rereview


- name: Install Bazel in PATH
if: ${{ steps.prerequisites.outputs.requires_default_bazel_installation == 'true' }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like everything with if: ${{steps.prerequisites.outputs.impacts_all_detected == 'false' }} should be put into its own workflow and only run on that if, so that:

  1. Clear separation of logic
  2. You don't have to repeat that if everywhere

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 pushed a few changes to cleanup the workflow:
-- always install jq, regardless of impacts_all_detected
-- set requires_default_bazel_installation to false if impacts_all_detected==true.

I think this cleans up the workflow, PTAL.

@@ -31,6 +35,6 @@ jobs:
shell: bash
run: |
target_count=`cat ${{ steps.compute.outputs.impacted_targets_out }} | wc -l`
if [[ $target_count -ne 2 ]]; then
if [[ $target_count -ne 0 ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We moved sha computation outside of the compute_impacted_targets script, and expect it as an input into the script. As opposed to running tests with a stable test branch and a moving main, we now run tests with a stable test branch and a stable main, such that we can pin the shas. In that case, we would expect no impacted targets to be computed.

@nikhilbirmiwal
Copy link
Contributor Author

Thanks -- FWIW, the PR is queued against an ephemeral trunk-io/merge-action repo, used for testing purposes only.

@nikhilbirmiwal nikhilbirmiwal merged commit 6a6b856 into main Sep 15, 2023
2 of 3 checks passed
@nikhilbirmiwal nikhilbirmiwal deleted the nikhil/all branch September 15, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants