Seperate Tests for bucketContextTests and gitRepoTests

This commit is contained in:
Kartik Verma 2018-11-02 19:35:02 +05:30
parent ead210ba6e
commit b9c678e6f8
No known key found for this signature in database
GPG Key ID: 1AB436B74ED67A64
1 changed files with 10 additions and 3 deletions

View File

@ -64,6 +64,7 @@ var additionalKanikoFlagsMap = map[string][]string{
}
var gitRepoTests = []string{"Dockerfile_test_git"}
var bucketContextTests = []string{"Dockerfile_test_copy_bucket"}
var reproducibleTests = []string{"Dockerfile_test_reproducible"}
// 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
additionalFlags := append(buildArgs, additionalDockerFlagsMap[dockerfile]...)
dockerImage := strings.ToLower(imageRepo + dockerPrefix + dockerfile)
dockerPath := "."
contextTest := bucketContextTests
if dockerfile == "Dockerfile_test_git" {
dockerPath = "../"
contextTest = gitRepoTests
}
dockerCmd := exec.Command("docker",
append([]string{"build",
"-t", dockerImage,
"-f", path.Join(dockerfilesPath, dockerfile),
"../"},
dockerPath},
additionalFlags...)...,
)
_, err := RunCommandWithoutTest(dockerCmd)
@ -162,10 +169,10 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do
contextFlag := "-c"
contextPath := buildContextPath
for _, d := range gitRepoTests {
for _, d := range contextTest {
if d == dockerfile {
contextFlag = "-b"
contextPath = "https://github.com/GoogleContainerTools/kaniko"
contextPath = "git://github.com/GoogleContainerTools/kaniko"
break
}
}