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:
Sharif Elgamal
2018-11-06 15:27:09 -08:00
committed by GitHub
parent 5ed45ed2fb
commit 224b7e2b41
11 changed files with 60 additions and 17 deletions
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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)
}