Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/int: ECR force delete and use go 1.18 #282

Merged
merged 3 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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