So we have a job that will generate some content that we need for our builds. It runs like 5 different scripts in succession, these scripts will generate the content, commit, then push to the repo on a specific branch. We are running these scripts against 3 different branches.
We are running these script in parallel with different jenkins machines (no shared workspaces).
The flow is like this:
- Find repo in home directory (again, this directory is not shared with other machines running in parallel) and checkout/pull/reset to desired branch
- copy repo into workspace to perform build actions (we copy into workspace because the repo is so large it takes 10m for jenkins to clone it from scratch)
- run script #1
- git commit -m "<constructed msg>"
- git push
- git clean -df
- Repeat starting from step 3 until all scripts are completed.
Here is the error we're getting when they run in parallel. Note, the job works perfectly fine if we do one branch at a time.
Command: git push Exitcode: 1 Standard Output: Error Stream: To <repo> ! [rejected] release/<branch> -> release/<same branch> (fetch first) error: failed to push some refs to '<repo>' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The error makes it seem like because they are all pushing at the same time there is some kind of conflict, but I would think this should only be the case if we're pushing to the same branches? These are all 3 diff branches. It seems one branch succeeded but the rest fail, so I think its obvious that the parallel nature of this is causing the issue, but I fail to understand why when its running on different machines, on different branches.