Merge pull request #313 from fkautz/pr_out_variables_shouldn_t_shadow_packages

variables shouldn't shadow packages
This commit is contained in:
Andrea Luzzardi 2021-04-12 10:32:23 -07:00 committed by GitHub
commit b8a4837bcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -672,7 +672,7 @@ func (p *Pipeline) FetchGit(ctx context.Context, op *compiler.Value, st llb.Stat
func (p *Pipeline) DockerBuild(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { func (p *Pipeline) DockerBuild(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) {
var ( var (
context = op.Lookup("context") dockerContext = op.Lookup("context")
dockerfile = op.Lookup("dockerfile") dockerfile = op.Lookup("dockerfile")
contextDef *bkpb.Definition contextDef *bkpb.Definition
@ -681,15 +681,15 @@ func (p *Pipeline) DockerBuild(ctx context.Context, op *compiler.Value, st llb.S
err error err error
) )
if !context.Exists() && !dockerfile.Exists() { if !dockerContext.Exists() && !dockerfile.Exists() {
return st, errors.New("context or dockerfile required") return st, errors.New("context or dockerfile required")
} }
// docker build context. This can come from another component, so we need to // docker build context. This can come from another component, so we need to
// compute it first. // compute it first.
if context.Exists() { if dockerContext.Exists() {
from := NewPipeline(op.Lookup("context").Path().String(), p.s) from := NewPipeline(op.Lookup("context").Path().String(), p.s)
if err := from.Do(ctx, context); err != nil { if err := from.Do(ctx, dockerContext); err != nil {
return st, err return st, err
} }
fromResult, err := from.Result() fromResult, err := from.Result()
@ -820,7 +820,7 @@ func (p *Pipeline) WriteFile(ctx context.Context, op *compiler.Value, st llb.Sta
} }
func (p *Pipeline) Mkdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { func (p *Pipeline) Mkdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) {
path, err := op.Lookup("path").String() pathString, err := op.Lookup("path").String()
if err != nil { if err != nil {
return st, err return st, err
} }
@ -836,7 +836,7 @@ func (p *Pipeline) Mkdir(ctx context.Context, op *compiler.Value, st llb.State)
} }
return st.Dir(dir).File( return st.Dir(dir).File(
llb.Mkdir(path, fs.FileMode(mode)), llb.Mkdir(pathString, fs.FileMode(mode)),
llb.WithCustomName(p.vertexNamef("Mkdir %s", path)), llb.WithCustomName(p.vertexNamef("Mkdir %s", pathString)),
), nil ), nil
} }

View File

@ -81,7 +81,7 @@ func (s Solver) Solve(ctx context.Context, st llb.State) (bkgw.Reference, error)
return nil, err return nil, err
} }
llb, err := dumpLLB(def) jsonLLB, err := dumpLLB(def)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -89,7 +89,7 @@ func (s Solver) Solve(ctx context.Context, st llb.State) (bkgw.Reference, error)
log. log.
Ctx(ctx). Ctx(ctx).
Trace(). Trace().
RawJSON("llb", llb). RawJSON("llb", jsonLLB).
Msg("solving") Msg("solving")
// call solve // call solve