remind101 / slashdeploy

GitHub Deployments for Slack
https://slashdeploy.io
BSD 2-Clause "Simplified" License
153 stars 20 forks source link

Slashdeploy can fail when you use mirrored repositories #182

Open jherico opened 3 years ago

jherico commented 3 years ago

I have a setup where I have a main repo graph-web which has CI jobs that mirror branches main-a and main-b to other repositories of graph-web-a and graph-web-b respectively.

There's an additional CircleCI task that runs on all branches that pushes a docker image to dockerhub tagged with the repo name and the commit hash.

However, I discovered that the github deployments for the mirror jobs were failing. Investigation led me to discover that when an event is received from github about a status change, Slashdeploy looks up ALL pending auto deployments related to corresponding commit hash, regardless of the repository: AutoDeployment.lock.active.where(sha: status.sha).each do |auto_deployment|

This means that when the docker_image CI task on the root repository completes, it triggers the deployment of the mirror-repository branch, which has not yet completed the same job, and therefore hasn't pushed the appropriate tag to dockerhub. The deployment can't find the docker image and fails.