0

I'm trying to setup continuous delivery for our company and have doubts on how to do it.

GOAL

The goal is to build and then deploy on staging everytime the master is updated.

The next step will be to have some interface so the project manager can validate the staging and trigger deployement onto client staging, then client validate and triggers deployement onto production.

What i think should be done

The building and testing (continuous integration) is working fine.

But in order to have delivery tracking, i think i should have a branch "staging" on wich i do the build and then push.

The problem

When i do that, i end up with conflicts on my branch "staging" : if 2 pipelines works in parallel, one ending before the other, the second won't be able to push because git will tell "Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing...".

I feel wrong ;)

I could do a push force but it feels like i'm doing something the wrong way.

What are your advices on this situation ?

user3005099
  • 153
  • 1
  • 6

1 Answers1

0

You've got what's essentially a locking problem. The best solution I've seen is that when it fails have it immediately kick off again. When it does so, the 'git pull' it does will be different (because the success of the other branch caused 'staging' to change its HEAD), and then it will merge the branch and run the tests again and try and push... and if it fails it will repeat, but if it succeeds then it's done.

pjz
  • 38,171
  • 5
  • 45
  • 60