mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
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.
This commit is contained in:
parent
f8bc240b02
commit
2200cb14ce
1 changed files with 5 additions and 1 deletions
|
|
@ -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…
Reference in a new issue