Skip to content

Draft: Add timestamp to SyncRemotesMergeRequest source branch name

Reuben Pereira requested to merge rp/sync-remotes-source-branch into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This will make the source branch name unique and reduce the possibility of the branch already existing. If the branch already exists, there is a strong possibility that the push to the branch will fail, due to the branch containing other changes.

The other option is to raise an error if the branch already exists. But this makes it difficult to easily retry the sync job.

An example error can be seen in https://ops.gitlab.net/gitlab-org/release/tools/-/jobs/6703956:

2022-03-31 16:48:36.208786 F ReleaseTools::RemoteRepository -- Failed to push -- {:remote=>:canonical, :ref=>"sync-canonical-with-security-changes", :output=>"To gitlab.com:gitlab-org/gitlab.git\n ! [rejected] sync-canonical-with-security-changes -> sync-canonical-with-security-changes (fetch first)\nerror: failed to push some refs to 'gitlab.com:gitlab-org/gitlab.git'\nhint: Updates were rejected because the remote contains work that you do\nhint: not have locally. This is usually caused by another repository pushing\nhint: to the same ref. You may want to first integrate the remote changes\nhint: (e.g., 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n"}

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports