File tree 3 files changed +23
-4
lines changed
pkg/skaffold/schema/defaults
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -33,17 +33,17 @@ func TestDiagnose(t *testing.T) {
33
33
tests := []struct {
34
34
name string
35
35
dir string
36
- args []string
37
36
}{
38
37
{name : "kaniko builder" , dir : "examples/kaniko" },
39
38
{name : "docker builder" , dir : "examples/nodejs" },
40
39
{name : "jib maven builder" , dir : "testdata/jib" },
40
+ {name : "jib gradle builder" , dir : "testdata/jib-gradle" },
41
41
{name : "bazel builder" , dir : "examples/bazel" },
42
- // todo add test cases for "jib gradle builder" and " custom builder"
42
+ { name : "custom builder", dir : "testdata/ custom" },
43
43
}
44
44
for _ , test := range tests {
45
45
t .Run (test .name , func (t * testing.T ) {
46
- skaffold .Diagnose (test . args ... ).InDir (test .dir ).RunOrFailOutput (t )
46
+ skaffold .Diagnose ().InDir (test .dir ).RunOrFailOutput (t )
47
47
})
48
48
}
49
49
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ package defaults
19
19
import (
20
20
"fmt"
21
21
22
- "github.com/mitchellh/go-homedir"
22
+ homedir "github.com/mitchellh/go-homedir"
23
23
"github.com/pkg/errors"
24
24
"github.com/sirupsen/logrus"
25
25
@@ -68,6 +68,7 @@ func Set(c *latest.SkaffoldConfig) error {
68
68
setDefaultWorkspace (a )
69
69
defaultToDockerArtifact (a )
70
70
setDefaultDockerfile (a )
71
+ setDefaultCustomDependencies (a )
71
72
}
72
73
73
74
for _ , pf := range c .PortForward {
@@ -154,6 +155,14 @@ func setDefaultDockerfile(a *latest.Artifact) {
154
155
}
155
156
}
156
157
158
+ func setDefaultCustomDependencies (a * latest.Artifact ) {
159
+ if a .CustomArtifact != nil {
160
+ if a .CustomArtifact .Dependencies == nil {
161
+ a .CustomArtifact .Dependencies = & latest.CustomDependencies {}
162
+ }
163
+ }
164
+ }
165
+
157
166
// SetDefaultDockerArtifact sets defaults on docker artifacts
158
167
func SetDefaultDockerArtifact (a * latest.DockerArtifact ) {
159
168
a .DockerfilePath = valueOrDefault (a .DockerfilePath , constants .DefaultDockerfilePath )
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ func TestSetDefaults(t *testing.T) {
42
42
},
43
43
},
44
44
},
45
+ {
46
+ ImageName : "third" ,
47
+ ArtifactType : latest.ArtifactType {
48
+ CustomArtifact : & latest.CustomArtifact {},
49
+ },
50
+ },
45
51
},
46
52
},
47
53
},
@@ -58,6 +64,10 @@ func TestSetDefaults(t *testing.T) {
58
64
testutil .CheckDeepEqual (t , "second" , cfg .Build .Artifacts [1 ].ImageName )
59
65
testutil .CheckDeepEqual (t , "folder" , cfg .Build .Artifacts [1 ].Workspace )
60
66
testutil .CheckDeepEqual (t , "Dockerfile.second" , cfg .Build .Artifacts [1 ].DockerArtifact .DockerfilePath )
67
+
68
+ testutil .CheckDeepEqual (t , "third" , cfg .Build .Artifacts [2 ].ImageName )
69
+ testutil .CheckDeepEqual (t , []string (nil ), cfg .Build .Artifacts [2 ].CustomArtifact .Dependencies .Paths )
70
+ testutil .CheckDeepEqual (t , []string (nil ), cfg .Build .Artifacts [2 ].CustomArtifact .Dependencies .Ignore )
61
71
}
62
72
63
73
func TestSetDefaultsOnCluster (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments