Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

ci: limiting mirroring concurrency #93

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Conversation

DeveloperC286
Copy link
Owner

Problem

Mirroring actions are failing because other actions have already mirrored what it was about to mirror.

E.g.

Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/earthly_upgrade': unable to resolve reference 'refs/heads/earthly_upgrade'
remote: error: cannot lock ref 'refs/pull/92/head': reference already exists
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
   f4c0fa2..dfc1c32  main -> main
 ! [remote rejected] earthly_upgrade (failed to update ref)
 ! [remote rejected] refs/pull/92/head -> refs/pull/92/head (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'
Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/main': is at dfc1c32915b02d9cb35ab831580cb9216eaf06bd but expected f4c0fa268dbaba173d11160b562dd823c5427d3b
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
 - [deleted]         earthly_upgrade
 * [new reference]   refs/pull/92/head -> refs/pull/92/head
 ! [remote rejected] main -> main (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'

Solution

So we are limiting the concurrency to prevent this.

Related

## Problem
Mirroring actions are failing because other actions have already mirrored what
it was about to mirror.

E.g.

* https://github.com/DeveloperC286/starlingbanktechnicalchallenge/actions/runs/7639729071/job/20813352947

```
Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/earthly_upgrade': unable to resolve reference 'refs/heads/earthly_upgrade'
remote: error: cannot lock ref 'refs/pull/92/head': reference already exists
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
   f4c0fa2..dfc1c32  main -> main
 ! [remote rejected] earthly_upgrade (failed to update ref)
 ! [remote rejected] refs/pull/92/head -> refs/pull/92/head (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'
```

* https://github.com/DeveloperC286/starlingbanktechnicalchallenge/actions/runs/7639728988/job/20813352607

```
Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/main': is at dfc1c32 but expected f4c0fa2
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
 - [deleted]         earthly_upgrade
 * [new reference]   refs/pull/92/head -> refs/pull/92/head
 ! [remote rejected] main -> main (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'
```

## Solution
So we are limiting the concurrency to prevent this. But we are not cancelling
in progress actions, as the cancellation is shown as a failure in the UI. So even
though some actions will mirror nothing and are unnecessary we will do it so the
UI shows a passing workflow.

## Related
* https://docs.github.com/en/actions/using-jobs/using-concurrency
* #85
@DeveloperC286 DeveloperC286 merged commit 43f9143 into main Jan 24, 2024
12 checks passed
@DeveloperC286 DeveloperC286 deleted the mirroring_concurrency branch January 24, 2024 12:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant