hcp: set the status to CANCELLED when a build is

Related to the previous behaviour problem, this changes how the status
of a build is set on HCP Packer, as a cancelled build is different from
a failed one, we can set it to the appropriate state on cancellation.
pull/12185/head
Lucas Bajolet 3 years ago committed by Lucas Bajolet
parent f8bc240b02
commit 2200cb14ce

@ -569,7 +569,11 @@ func (b *Bucket) completeBuild(
}
if buildErr != nil {
err := b.UpdateBuildStatus(ctx, buildName, models.HashicorpCloudPackerBuildStatusFAILED)
status := models.HashicorpCloudPackerBuildStatusFAILED
if ctx.Err() != nil {
status = models.HashicorpCloudPackerBuildStatusCANCELLED
}
err := b.UpdateBuildStatus(context.Background(), buildName, status)
if err != nil {
log.Printf("[ERROR] failed to update build %q status to FAILED: %s", buildName, err)
}

Loading…
Cancel
Save