Skip to content

Commit

Permalink
Log in to public ECR for E2E test (#8001)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdoherty4 authored Apr 18, 2024
1 parent 55d37ae commit 7bf18bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/test/e2e/ecr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package e2e

import (
"fmt"

"github.com/go-logr/logr"

"github.com/aws/eks-anywhere/internal/pkg/ssm"
)

func (e *E2ESession) loginToPublicECR() error {
e.logger.V(1).Info("Logging in to public ECR")

command := "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws"
if err := ssm.Run(e.session, logr.Discard(), e.instanceId, command, ssmTimeout); err != nil {
return fmt.Errorf("sign in to public ecr: %v", err)
}

e.logger.V(1).Info("Logged in to public ECR")

return nil
}
5 changes: 5 additions & 0 deletions internal/test/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ func (e *E2ESession) setup(regex string) error {
return err
}

err = e.loginToPublicECR()
if err != nil {
return err
}

ipPool := e.ipPool.ToString()
if ipPool != "" {
e.testEnvVars[e2etests.ClusterIPPoolEnvVar] = ipPool
Expand Down

0 comments on commit 7bf18bb

Please sign in to comment.