Skip to content

Commit

Permalink
Merge pull request #282 from fluxcd/aws-ecr-force-delete
Browse files Browse the repository at this point in the history
tests/int: ECR force delete and use go 1.18
  • Loading branch information
darkowlzz authored Jul 13, 2022
2 parents 3f684a0 + ff3d160 commit c18d406
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 222 deletions.
7 changes: 4 additions & 3 deletions tests/integration/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func getEKSClientToken(ctx context.Context, clusterName string) ([]byte, error)
func createKubeconfigEKS(ctx context.Context, state map[string]*tfjson.StateOutput, kcPath string) error {
clusterName := state["eks_cluster_name"].Value.(string)
eksHost := state["eks_cluster_endpoint"].Value.(string)
eksClusterArn := state["eks_cluster_endpoint"].Value.(string)
eksClusterArn := state["eks_cluster_arn"].Value.(string)
eksCa := state["eks_cluster_ca_certificate"].Value.(string)
eksToken, err := getEKSClientToken(ctx, clusterName)
if err != nil {
return fmt.Errorf("failed to obtain auth token: %w", err)
}

kubeconfigYaml := kubeconfigWithClusterAuthToken(string(eksToken), eksCa, eksHost, eksClusterArn, eksClusterArn)
kubeconfigYaml := kubeconfigWithClusterAuthToken(string(eksToken), eksCa, eksHost, eksClusterArn, clusterName)

f, err := os.Create(kcPath)
if err != nil {
Expand All @@ -95,9 +95,10 @@ func registryLoginECR(ctx context.Context, output map[string]*tfjson.StateOutput
// repositories to be created explicitly using their API before pushing
// image.
repoURL := output["ecr_repository_url"].Value.(string)
region := output["region"].Value.(string)

if err := tftestenv.RunCommand(ctx, "./",
fmt.Sprintf("aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin %s", repoURL),
fmt.Sprintf("aws ecr get-login-password --region %s | docker login --username AWS --password-stdin %s", region, repoURL),
tftestenv.RunCommandOptions{},
); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/fluxcd/image-reflector-controller/tests/integration

go 1.17
go 1.18

replace github.com/fluxcd/image-reflector-controller/tests/tftestenv => ../tftestenv

Expand Down
Loading

0 comments on commit c18d406

Please sign in to comment.