Merge pull request #9720 from hashicorp/skip_pp_on_cancel

Skip post-processors when build is cancelled
This commit is contained in:
Megan Marsh 2020-08-07 09:13:37 -07:00 committed by GitHub
commit 4c627c57ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -305,6 +305,13 @@ func (b *CoreBuild) Run(ctx context.Context, originalUi Ui) ([]Artifact, error)
errors := make([]error, 0)
keepOriginalArtifact := len(b.PostProcessors) == 0
select {
case <-ctx.Done():
log.Println("Build was cancelled. Skipping post-processors.")
return nil, nil
default:
}
// Run the post-processors
PostProcessorRunSeqLoop:
for _, ppSeq := range b.PostProcessors {