Ensure BaseName of Stage is not blank
Related: https://github.com/moby/moby/issues/37325 Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>docker-18.09
parent
3f8ab160d5
commit
813575f62a
|
@ -85,6 +85,9 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
|||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if name == "" {
|
||||
return nil, nil, errors.Errorf("base name (%s) should not be blank", st.BaseName)
|
||||
}
|
||||
st.BaseName = name
|
||||
|
||||
ds := &dispatchState{
|
||||
|
|
|
@ -41,4 +41,12 @@ COPY --from=0 f2 /
|
|||
Target: "nosuch",
|
||||
})
|
||||
assert.Error(t, err)
|
||||
|
||||
df = `FROM "" AS foo`
|
||||
_, _, err = Dockerfile2LLB(appcontext.Context(), []byte(df), ConvertOpt{})
|
||||
assert.Error(t, err)
|
||||
|
||||
df = `FROM ${BLANK} AS foo`
|
||||
_, _, err = Dockerfile2LLB(appcontext.Context(), []byte(df), ConvertOpt{})
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue