e2e: Set ARC_E2E_DO_DOCKER_BUILD to verify docker-build

This commit is contained in:
Yusuke Kuoka 2022-08-25 04:43:03 +00:00
parent f7c336f9dd
commit f70f325f48
1 changed files with 59 additions and 55 deletions

View File

@ -121,6 +121,7 @@ func TestE2E(t *testing.T) {
t.Fatalf("Failed to parse duration %q: %v", vt, err)
}
}
env.doDockerBuild = os.Getenv("ARC_E2E_DO_DOCKER_BUILD") != ""
t.Run("build and load images", func(t *testing.T) {
env.buildAndLoadImages(t)
@ -317,6 +318,7 @@ type env struct {
minReplicas int64
dockerdWithinRunnerContainer bool
rootlessDocker bool
doDockerBuild bool
containerMode string
remoteKubeconfig string
imagePullSecretName string
@ -732,7 +734,7 @@ func (e *env) createControllerNamespaceAndServiceAccount(t *testing.T) {
func (e *env) installActionsWorkflow(t *testing.T, kind DeployKind, testID string) {
t.Helper()
installActionsWorkflow(t, e.testName+" "+testID, e.runnerLabel(testID), testResultCMNamePrefix, e.repoToCommit, kind, e.testJobs(testID), !e.rootlessDocker)
installActionsWorkflow(t, e.testName+" "+testID, e.runnerLabel(testID), testResultCMNamePrefix, e.repoToCommit, kind, e.testJobs(testID), !e.rootlessDocker, e.doDockerBuild)
}
func (e *env) testJobs(testID string) []job {
@ -774,7 +776,7 @@ func createTestJobs(id, testResultCMNamePrefix string, numJobs int) []job {
const Branch = "main"
// useSudo also implies rootful docker and the use of buildx cache export/import
func installActionsWorkflow(t *testing.T, testName, runnerLabel, testResultCMNamePrefix, testRepo string, kind DeployKind, testJobs []job, useSudo bool) {
func installActionsWorkflow(t *testing.T, testName, runnerLabel, testResultCMNamePrefix, testRepo string, kind DeployKind, testJobs []job, useSudo, doDockerBuild bool) {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
@ -873,6 +875,7 @@ func installActionsWorkflow(t *testing.T, testName, runnerLabel, testResultCMNam
},
)
if doDockerBuild {
if !kubernetesContainerMode {
setupBuildXActionWith := &testing.With{
BuildkitdFlags: "--debug",
@ -915,6 +918,8 @@ func installActionsWorkflow(t *testing.T, testName, runnerLabel, testResultCMNam
fmt.Sprintf("-f %s .", dockerfile),
},
)
}
}
if useSudo {
steps = append(steps,
@ -940,7 +945,6 @@ func installActionsWorkflow(t *testing.T, testName, runnerLabel, testResultCMNam
Run: fmt.Sprintf("./test.sh %s %s", t.Name(), j.testArg),
},
)
}
wf.Jobs[j.name] = testing.Job{
RunsOn: runnerLabel,