adobe / rules_gitops

This repository contains rules for continuous, GitOps driven Kubernetes deployments.
Apache License 2.0
172 stars 43 forks source link

Race condition on creating a deployment PR #128

Open apesternikov opened 1 year ago

apesternikov commented 1 year ago

There was a race condition observed:

precondition: deployment branch deploy/name and PR exists a new gitops workflow run that include update to the deployment prer in the run fetches the repo with deploy/* branches and start rendering manifests original PR 1 merged and branch automatically deleted prer in the run pushes the updated deployment branch and creates a new PR

As a result, the newly created branch and PR includes exact copy of the commits history from the original branch which causes a merge conflict since changes are already present in the target branch (main)

apesternikov commented 1 year ago

We have discussed this issue offline. Looks like the window when such race condition may occur may be reduced. The race condition occurs only when existing deploy branch is updated and force pushed as a new one. prer should only use git push --force when no previous deployment branch exists and if such push fails the whole prer run should be reexecuted starting from git fetch This does not solve the problem completely since small time window between pushing the branch and creating a PR still exist.