Skip to content

Commit 7304f7b

Browse files
committed
Support pre-built pull secret via E2E_NODE_PULL_SECRET
This is helpful for the EKS infrastructure and testing because the second upgrade image is built from the first one and pushed to the EKS registry. Therefore, the images might come from different registries and could requires multiple credentials. Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 497a7c1 commit 7304f7b

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ EKS_REGISTRY_HOST ?=
130130
EKS_REGISTRY_USER ?=
131131
EKS_REGISTRY_PASSWORD ?=
132132
EKS_IMAGE_PULL_SECRET ?=
133+
EKS_NODE_PULL_SECRET ?=
133134

134135
.PHONY: e2e-eks
135136
e2e-eks: ## Run e2e tests against EKS. V=1 for verbose. RUN=<regex> to filter.
@@ -149,6 +150,7 @@ e2e-eks: ## Run e2e tests against EKS. V=1 for verbose. RUN=<regex> to filter.
149150
$(if $(RELEASED_OPERATOR_TAG),E2E_OPERATOR_RELEASE_TAG=$(RELEASED_OPERATOR_TAG)) \
150151
$(if $(RELEASED_OPERATOR_IMG),E2E_OPERATOR_RELEASED_IMG=$(RELEASED_OPERATOR_IMG)) \
151152
$(if $(EKS_IMAGE_PULL_SECRET),E2E_IMAGE_PULL_SECRET=$(EKS_IMAGE_PULL_SECRET)) \
153+
E2E_NODE_PULL_SECRET="$(EKS_NODE_PULL_SECRET)" \
152154
ARTIFACTS="$(ARTIFACTS)" \
153155
go test -timeout 60m -count=1 -parallel 2 $(if $(V),-v) $(if $(RUN),-run '$(RUN)') .
154156

‎test/e2e/e2eutil/env.go‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,22 @@ func (e *Env) RegistryPassword() string {
355355
func (e *Env) createNodePullSecret(t *testing.T) {
356356
t.Helper()
357357

358-
authStr := base64.StdEncoding.EncodeToString(
359-
[]byte(e.registryUser + ":" + e.registryPassword),
360-
)
361-
dockerCfg := fmt.Sprintf(
362-
`{"auths":{%q:{"auth":"%s"}}}`,
363-
e.registryHost, authStr,
364-
)
358+
var dockerCfgBytes []byte
359+
if envSecret := os.Getenv("E2E_NODE_PULL_SECRET"); envSecret != "" {
360+
var err error
361+
dockerCfgBytes, err = base64.StdEncoding.DecodeString(envSecret)
362+
if err != nil {
363+
t.Fatalf("decoding E2E_NODE_PULL_SECRET: %v", err)
364+
}
365+
} else {
366+
authStr := base64.StdEncoding.EncodeToString(
367+
[]byte(e.registryUser + ":" + e.registryPassword),
368+
)
369+
dockerCfgBytes = []byte(fmt.Sprintf(
370+
`{"auths":{%q:{"auth":"%s"}}}`,
371+
e.registryHost, authStr,
372+
))
373+
}
365374

366375
secretName := e.testID + "-node-pull-secret"
367376
secret := &corev1.Secret{
@@ -371,7 +380,7 @@ func (e *Env) createNodePullSecret(t *testing.T) {
371380
},
372381
Type: corev1.SecretTypeDockerConfigJson,
373382
Data: map[string][]byte{
374-
corev1.DockerConfigJsonKey: []byte(dockerCfg),
383+
corev1.DockerConfigJsonKey: dockerCfgBytes,
375384
},
376385
}
377386

0 commit comments

Comments
 (0)