Merge pull request #1633 from wangyumu/add-buildkit-syntax-build-arg
build-arg add support BUILDKIT_SYNTAXv0.8
commit
898d720788
|
@ -53,6 +53,7 @@ const (
|
|||
keyNameDockerfile = "dockerfilekey"
|
||||
keyContextSubDir = "contextsubdir"
|
||||
keyContextKeepGitDir = "build-arg:BUILDKIT_CONTEXT_KEEP_GIT_DIR"
|
||||
keySyntax = "build-arg:BUILDKIT_SYNTAX"
|
||||
)
|
||||
|
||||
var httpPrefix = regexp.MustCompile(`^https?://`)
|
||||
|
@ -317,8 +318,14 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
|||
}
|
||||
|
||||
if _, ok := opts["cmdline"]; !ok {
|
||||
ref, cmdline, loc, ok := dockerfile2llb.DetectSyntax(bytes.NewBuffer(dtDockerfile))
|
||||
if ok {
|
||||
if cmdline, ok := opts[keySyntax]; ok {
|
||||
p := strings.SplitN(strings.TrimSpace(cmdline), " ", 2)
|
||||
res, err := forwardGateway(ctx, c, p[0], cmdline)
|
||||
if err != nil && len(errdefs.Sources(err)) == 0 {
|
||||
return nil, errors.Wrapf(err, "failed with %s = %s", keySyntax, cmdline)
|
||||
}
|
||||
return res, err
|
||||
} else if ref, cmdline, loc, ok := dockerfile2llb.DetectSyntax(bytes.NewBuffer(dtDockerfile)); ok {
|
||||
res, err := forwardGateway(ctx, c, ref, cmdline)
|
||||
if err != nil && len(errdefs.Sources(err)) == 0 {
|
||||
return nil, wrapSource(err, sourceMap, loc)
|
||||
|
|
Loading…
Reference in New Issue