Seperate Tests for bucketContextTests and gitRepoTests
This commit is contained in:
parent
ead210ba6e
commit
b9c678e6f8
|
|
@ -64,6 +64,7 @@ var additionalKanikoFlagsMap = map[string][]string{
|
||||||
}
|
}
|
||||||
|
|
||||||
var gitRepoTests = []string{"Dockerfile_test_git"}
|
var gitRepoTests = []string{"Dockerfile_test_git"}
|
||||||
|
var bucketContextTests = []string{"Dockerfile_test_copy_bucket"}
|
||||||
var reproducibleTests = []string{"Dockerfile_test_reproducible"}
|
var reproducibleTests = []string{"Dockerfile_test_reproducible"}
|
||||||
|
|
||||||
// GetDockerImage constructs the name of the docker image that would be built with
|
// GetDockerImage constructs the name of the docker image that would be built with
|
||||||
|
|
@ -148,11 +149,17 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
|
||||||
// build docker image
|
// build docker image
|
||||||
additionalFlags := append(buildArgs, additionalDockerFlagsMap[dockerfile]...)
|
additionalFlags := append(buildArgs, additionalDockerFlagsMap[dockerfile]...)
|
||||||
dockerImage := strings.ToLower(imageRepo + dockerPrefix + dockerfile)
|
dockerImage := strings.ToLower(imageRepo + dockerPrefix + dockerfile)
|
||||||
|
dockerPath := "."
|
||||||
|
contextTest := bucketContextTests
|
||||||
|
if dockerfile == "Dockerfile_test_git" {
|
||||||
|
dockerPath = "../"
|
||||||
|
contextTest = gitRepoTests
|
||||||
|
}
|
||||||
dockerCmd := exec.Command("docker",
|
dockerCmd := exec.Command("docker",
|
||||||
append([]string{"build",
|
append([]string{"build",
|
||||||
"-t", dockerImage,
|
"-t", dockerImage,
|
||||||
"-f", path.Join(dockerfilesPath, dockerfile),
|
"-f", path.Join(dockerfilesPath, dockerfile),
|
||||||
"../"},
|
dockerPath},
|
||||||
additionalFlags...)...,
|
additionalFlags...)...,
|
||||||
)
|
)
|
||||||
_, err := RunCommandWithoutTest(dockerCmd)
|
_, err := RunCommandWithoutTest(dockerCmd)
|
||||||
|
|
@ -162,10 +169,10 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
|
||||||
|
|
||||||
contextFlag := "-c"
|
contextFlag := "-c"
|
||||||
contextPath := buildContextPath
|
contextPath := buildContextPath
|
||||||
for _, d := range gitRepoTests {
|
for _, d := range contextTest {
|
||||||
if d == dockerfile {
|
if d == dockerfile {
|
||||||
contextFlag = "-b"
|
contextFlag = "-b"
|
||||||
contextPath = "https://github.com/GoogleContainerTools/kaniko"
|
contextPath = "git://github.com/GoogleContainerTools/kaniko"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue