Skip to content

Commit 7db9434

Browse files
Merge pull request #20575 from gabemontero/add-prow-gcp-agent-imgs-jenkins-ext-tst
enable override of agent pod template images during prow/gcp invocati…
2 parents 48a1596 + b8e457e commit 7db9434

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

test/extended/builds/jenkins_plugin.go

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ var _ = g.Describe("[Feature:Builds][Slow] openshift pipeline plugin", func() {
161161
// with the startup costs now of jenkins 2.89 or greater and trying to incur those during startup, need more memory
162162
// to avoid deployment timeouts
163163
newAppArgs := []string{"-f", exutil.FixturePath("..", "..", "examples", "jenkins", "jenkins-ephemeral-template.json"), "-p", "MEMORY_LIMIT=2Gi", "-p", "DISABLE_ADMINISTRATIVE_MONITORS=true"}
164+
newAppArgs = jenkins.OverridePodTemplateImages(newAppArgs)
164165

165166
useSnapshotImage := false
166167
origPluginNewAppArgs, useOrigPluginSnapshotImage := jenkins.SetupSnapshotImage(jenkins.UseLocalPluginSnapshotEnvVarName, localPluginSnapshotImage, localPluginSnapshotImageStream, newAppArgs, oc)

test/extended/builds/pipeline.go

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ var _ = g.Describe("[Feature:Builds][Slow] openshift pipeline build", func() {
145145

146146
// our pipeline jobs, between jenkins and oc invocations, need more mem than the default
147147
newAppArgs := []string{"--template", fmt.Sprintf("%s/%s", oc.Namespace(), jenkinsTemplateName), "-p", "MEMORY_LIMIT=2Gi", "-p", "DISABLE_ADMINISTRATIVE_MONITORS=true"}
148+
newAppArgs = jenkins.OverridePodTemplateImages(newAppArgs)
148149
clientPluginNewAppArgs, useClientPluginSnapshotImage := jenkins.SetupSnapshotImage(jenkins.UseLocalClientPluginSnapshotEnvVarName, localClientPluginSnapshotImage, localClientPluginSnapshotImageStream, newAppArgs, oc)
149150
syncPluginNewAppArgs, useSyncPluginSnapshotImage := jenkins.SetupSnapshotImage(jenkins.UseLocalSyncPluginSnapshotEnvVarName, localSyncPluginSnapshotImage, localSyncPluginSnapshotImageStream, newAppArgs, oc)
150151

test/extended/util/jenkins/ref.go

+14
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,20 @@ func FindJenkinsPod(oc *exutil.CLI) *kapiv1.Pod {
356356
return &pods.Items[0]
357357
}
358358

359+
// OverridePodTemplateImages sees if this is a prow-gcp e2e test invocation, and we want to override the agent image for the default pod templates;
360+
// the jenkins image will pick up the env vars passed to new-app and update the image field of the pod templates with the values
361+
func OverridePodTemplateImages(newAppArgs []string) []string {
362+
nodejsAgent := os.Getenv("IMAGE_NODEJS_AGENT")
363+
if len(strings.TrimSpace(nodejsAgent)) > 0 {
364+
newAppArgs = append(newAppArgs, "-e", fmt.Sprintf("NODEJS_SLAVE_IMAGE=%s", nodejsAgent))
365+
}
366+
mavenAgent := os.Getenv("IMAGE_MAVEN_AGENT")
367+
if len(strings.TrimSpace(mavenAgent)) > 0 {
368+
newAppArgs = append(newAppArgs, "-e", fmt.Sprintf("MAVEN_SLAVE_IMAGE=%s", mavenAgent))
369+
}
370+
return newAppArgs
371+
}
372+
359373
// pulls in a jenkins image built from a PR change for one of our plugins
360374
func SetupSnapshotImage(envVarName, localImageName, snapshotImageStream string, newAppArgs []string, oc *exutil.CLI) ([]string, bool) {
361375
tag := []string{localImageName}

0 commit comments

Comments
 (0)