Skip to content

Commit a884912

Browse files
committed
fix(staged-dockerfile): explanatory error message when building unsupported Dockerfile conf
Print explanatory error for user to enable WERF_STAGED_DOCKERFILE_VERSION=v2 when Dockerfile contains only single FROM instruction. Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
1 parent cb13cf7 commit a884912

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/build/image/dockerfile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile,
230230
instrNum++
231231
}
232232

233+
if werf.GetStagedDockerfileVersion() == werf.StagedDockerfileV1 {
234+
if len(img.stages) == 0 {
235+
return nil, fmt.Errorf("unsupported configuration, please enable staged dockerfile builder v2 by setting environment variable WERF_STAGED_DOCKERFILE_VERSION=v2")
236+
}
237+
}
238+
233239
appendImageToCurrentSet(img)
234240
}
235241

0 commit comments

Comments
 (0)