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 ?