Merge pull request #470 from yui-knk/ensure_arg_is_not_blank
Ensure BaseName of Stage is not blankdocker-18.09
commit
3b9737dd5a
|
@ -100,6 +100,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