Skip to content

Commit

Permalink
Merge pull request #3209 from jedevc/dockerfile-consts-for-prefixes
Browse files Browse the repository at this point in the history
chore: use private consts for dockerfile prefixes
  • Loading branch information
tonistiigi authored Oct 21, 2022
2 parents 93d66aa + fad945e commit b6de3ca
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/dockerfile/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ const (
defaultDockerfileName = "Dockerfile"
dockerignoreFilename = ".dockerignore"

buildArgPrefix = "build-arg:"
labelPrefix = "label:"
buildArgPrefix = "build-arg:"
labelPrefix = "label:"
contextPrefix = "context:"
inputMetadataPrefix = "input-metadata:"

keyTarget = "target"
keyFilename = "filename"
Expand Down Expand Up @@ -897,7 +899,7 @@ func contextByNameFunc(c client.Client, sessionID string) func(context.Context,

func contextByName(ctx context.Context, c client.Client, sessionID, name string, platform *ocispecs.Platform, resolveMode string) (*llb.State, *dockerfile2llb.Image, *binfotypes.BuildInfo, error) {
opts := c.BuildOpts().Opts
v, ok := opts["context:"+name]
v, ok := opts[contextPrefix+name]
if !ok {
return nil, nil, nil, nil
}
Expand Down Expand Up @@ -1065,7 +1067,7 @@ func contextByName(ctx context.Context, c client.Client, sessionID, name string,
if !ok {
return nil, nil, nil, errors.Errorf("invalid input %s for %s", vv[1], name)
}
md, ok := opts["input-metadata:"+vv[1]]
md, ok := opts[inputMetadataPrefix+vv[1]]
if ok {
m := make(map[string][]byte)
if err := json.Unmarshal([]byte(md), &m); err != nil {
Expand Down

0 comments on commit b6de3ca

Please sign in to comment.