Closed droyad closed 4 years ago
Possibly related to #5372
Work around to this is to create a new release and deploy that once.
We should fix this on LTS
Duplicate of #4563?
Release Note: Fix for auto-deploy machines becoming available during a deployment
Just reading into this further, while it's related to #5372, I think there is a different issue going on here with tenant ordering, and performance-related code changes, which may not be fixed with the previously linked PR. Re-opening for the performance team to review.
The changes to resolve https://github.com/OctopusDeploy/Issues/issues/5911 also resolve this issue.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.
When a machine comes online but the release that should be deployed to it is currently being deployed (or queued) to the same environment, that machine is skipped (so that machines are batched together).
The code that works out which machines are missed casts a too wide of a net. It usually picks up all machines that were changed since the first deployment of that release to the environment, not just the deployment(s) that ran during the missed period.
The error lies in the
EventSourceDeployments
where is joins the finished event back to the start events based onRelatedDocumentId
. As shown in the below screenshot theRelatedDocumentId
s are not guaranteed to be in the same order. This causes the join to only find the originalDeploymentQueued
event (Red
) instead of the one related to theDeploymentFailed/Succeded
event (Blue
)Additionally, the code at https://github.com/OctopusDeploy/OctopusDeploy/blob/b6960a3ad9114b273a61787c55619acade27ffa3/source/Octopus.Server/Schedules/AutoDeployments/AutoDeployMachineFinder.cs#L83 loops over all the missed deployments gathering machines, creating duplicate entries and many slow queries. This could most likely be improved my getting the min
deployment.StartAutoId
and maxdeployment.EndAutoId
and doing theGetDeploymentTargetsThatHaveTriggeredBetweenAutoIds
call once.The same approach could be used to incorporate this call https://github.com/OctopusDeploy/OctopusDeploy/blob/002df1007071e5eec44166046592f6ba5f85ba90/source/Octopus.Server/Schedules/AutoDeployments/AutoDeployTriggerProcessor.cs#L48 so that we only query for machine events table once.
The duplication issue has been worked around by this change https://github.com/OctopusDeploy/OctopusDeploy/pull/3637/files#diff-b150f59995fb77baf21986e4ed9e557fR57