Skip to content

fix concurrency on Java PR's#1595

Merged
copybara-service[bot] merged 1 commit intoGoogleCloudPlatform:mainfrom
Polber:jkinard/fix-concurrency
May 23, 2024
Merged

fix concurrency on Java PR's#1595
copybara-service[bot] merged 1 commit intoGoogleCloudPlatform:mainfrom
Polber:jkinard/fix-concurrency

Conversation

@Polber
Copy link
Copy Markdown
Contributor

@Polber Polber commented May 22, 2024

#1526 was merged in an attempt to cancel duplicate runs of the same workflow when the same PR is updated. However, upon looking at the backlog of Java PR actions, this is clearly not WAI.

I tested this change on my personal fork, and can confirm that runs already running are cancelled when the same PR is updated.

This works by instead looking at the current workflow (in this case, it is always Java PR) and cancels existing runs of the workflow that are running on the same ref (branch), since each PR will have a unique branch that it is running on.

Using example from GitHub actions docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow

Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
@Polber Polber requested a review from damccorm May 22, 2024 21:10
@Polber Polber self-assigned this May 22, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.93%. Comparing base (6f82814) to head (2ed3b5a).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1595      +/-   ##
============================================
+ Coverage     40.80%   40.93%   +0.12%     
- Complexity     2832     2833       +1     
============================================
  Files           743      742       -1     
  Lines         43166    43074      -92     
  Branches       4609     4597      -12     
============================================
+ Hits          17615    17631      +16     
+ Misses        24044    23936     -108     
  Partials       1507     1507              
Components Coverage Δ
spanner-templates 59.59% <ø> (+<0.01%) ⬆️
spanner-import-export 64.41% <ø> (+0.02%) ⬆️
spanner-live-forward-migration 73.64% <ø> (ø)
spanner-live-reverse-replication 48.66% <ø> (ø)
spanner-bulk-migration 78.07% <ø> (ø)

see 7 files with indirect coverage changes


concurrency:
group: java-pr-${{ github.event.issue.number || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this will help much. ${{ github.workflow }} will just resolve to java-pr anyways. ${{ github.ref }} is probably better than github.run_id for scheduled runs (which only run every 12 hours anyways), but it is equivalent to github.event.issue.number for PRs since any PR runs will be the same PR number.

Note that jobs are getting cancelled today - https://github.com/GoogleCloudPlatform/DataflowTemplates/actions?query=is%3Acancelled

I'm fine taking this (its a bit cleaner) but I think the real problem is mostly just that our build times have gone up dramatically recently.

@damccorm damccorm added the Google LGTM Approval of a pull request to be merged into the repository label May 23, 2024
@copybara-service copybara-service bot merged commit 6f3bcf9 into GoogleCloudPlatform:main May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Google LGTM Approval of a pull request to be merged into the repository size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants