Auto Deployment triggers multiple deploys
dblandin opened this issue · comments
We recently enabled Status webhook events to let Heaven handle auto-deployment of passing master builds but we've encountered some odd behavior and had to disable it pretty quickly. First, it seems like multiple deployments are triggered.
Here's a screenshot of my notification output after merging a PR containing just 1 commit:
I'm not too familiar with the intent behind the Deployment.latest_for_name_with_owner
class method but a deployment seems to trigger for each result returned.
We're deploying 3 apps trough heaven currently.
Here are some counts from Deployment.latest_for_name_with_owner
:
> Deployment.latest_for_name_with_owner('dscout/dscout').count
=> 4
> Deployment.latest_for_name_with_owner('dscout/dscout-web').count
=> 5
> Deployment.latest_for_name_with_owner('dscout/dscout-efflux').count
=> 6
Are multiple results expected?
There's probably something really awful in there that needs to be revisited. Hopefully I can take a look at all of this next week.
Is this still a thing?
Likely is. I haven't dared to enable this again without writing some specs.
I just turned the Commit status updated from the API.
flag back on for our application's webhook and this happened to me too ( turned it back off right quick afterwards 👅 )
Running the latest version of Heaven too
On my case it's triggering two deployments to production because https://github.com/atmos/heaven/blob/master/app/models/deployment.rb#L7-L20 returns two Deployment, one for production and one for staging.
What's the expected behavior for auto deploy with multiple environments? Deploy master to all of them or only to production?
At GitHub we had auto-deploy enable hubot in <env>
and auto-deploy disable hubot in <env>
. So you could configure different environments as they became available. There are slightly different rules for whether the user who last deployed pushed more commits and whether it was locked. I feel like maybe we need better docs of the behavior so we can clarify the intended behavior w/ the few variables.
@atmos that behavior you described is not happening.
Have a look at
heaven/app/models/commit_status.rb
Lines 47 to 50 in c94ab2f
heaven/app/models/auto_deployment.rb
Lines 35 to 38 in c94ab2f
Looks like this was fixed with #158. Closing.