mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-09 06:05:48 +02:00
parse arg commands at the top of dockerfiles (#404)
* parse arg commands at the top of dockerfiles * fix pointer reference bug and remove debugging * fixing tests * account for meta args with no value * don't take fs snapshot if / is the only changed path * move metaArgs inside KanikoStage * removing unused property * check for any directory instead of just / * remove unnecessary check
This commit is contained in:
@@ -54,7 +54,7 @@ type stageBuilder struct {
|
||||
|
||||
// newStageBuilder returns a new type stageBuilder which contains all the information required to build the stage
|
||||
func newStageBuilder(opts *config.KanikoOptions, stage config.KanikoStage) (*stageBuilder, error) {
|
||||
sourceImage, err := util.RetrieveSourceImage(stage, opts.BuildArgs, opts)
|
||||
sourceImage, err := util.RetrieveSourceImage(stage, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -136,6 +136,7 @@ func (s *stageBuilder) build() error {
|
||||
}
|
||||
|
||||
args := dockerfile.NewBuildArgs(s.opts.BuildArgs)
|
||||
args.AddMetaArgs(s.stage.MetaArgs)
|
||||
for index, command := range cmds {
|
||||
if command == nil {
|
||||
continue
|
||||
|
||||
@@ -66,7 +66,7 @@ func Test_reviewConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func stage(t *testing.T, d string) config.KanikoStage {
|
||||
stages, err := dockerfile.Parse([]byte(d))
|
||||
stages, _, err := dockerfile.Parse([]byte(d))
|
||||
if err != nil {
|
||||
t.Fatalf("error parsing dockerfile: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user