From 76217df7c54752b6805fade67a548ec45c502919 Mon Sep 17 00:00:00 2001 From: Andrew Rynhard Date: Wed, 21 Nov 2018 12:56:37 -0800 Subject: [PATCH] feat: remove artifacts before creating (#84) --- pkg/pipeline/pipeline.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/pipeline/pipeline.go b/pkg/pipeline/pipeline.go index 045d1f03..ce5dc027 100644 --- a/pkg/pipeline/pipeline.go +++ b/pkg/pipeline/pipeline.go @@ -90,6 +90,9 @@ func (p *Pipeline) Build(metadata *metadata.Metadata, stages map[string]*stage.S // extract extracts an artifact from a docker image. func (p *Pipeline) extract(sha, image string, artifact *stage.Artifact) error { + if err := os.RemoveAll(artifact.Destination); err != nil { + return fmt.Errorf("failed to clean artifact destination: %v", err) + } argsSlice := [][]string{ {"create", "--name=" + sha, image}, {"cp", sha + ":" + artifact.Source, artifact.Destination},