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

oci/tests/int: Set exit code 1 on tf destroy fail #682

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

darkowlzz
Copy link
Contributor

@darkowlzz darkowlzz commented Nov 3, 2023

Explicitly set the test program exit code to 1 when terraform destroy fails to delete the infrastructure.

This was observed when GKE clusters failed to delete due to delete protection enabled by default in the latest version of terraform provider google.

Verified locally by reproducing the GKE delete failure:

module.gcr.google_artifact_registry_repository.this: Destroying... [id=projects/test-project/locations/us-central1/repositories/flux-test-sharing-sawfly]
module.gke.google_container_cluster.primary: Destroying... [id=projects/test-project/locations/us-central1/clusters/flux-test-sharing-sawfly]
module.gcr.google_artifact_registry_repository.this: Destruction complete after 3s

Error: Cannot destroy cluster because deletion_protection is set to true. Set it to false to proceed with cluster deletion.

2023/11/04 00:33:13 Failed to stop environment: could not destroy infrastructure: exit status 1

Error: Cannot destroy cluster because deletion_protection is set to true. Set it to false to proceed with cluster deletion.

FAIL    github.com/fluxcd/pkg/oci/tests/integration     248.069s
FAIL
make[1]: *** [Makefile:18: test] Error 1

Refer to the original issue logs - https://github.com/fluxcd/flux2/actions/runs/6744039127/job/18333072766#step:13:137 .

Explicitly set the test program exit code to 1 when terraform destroy
fails to delete the infrastructure.

This was observed when GKE clusters failed to delete due to delete
protection enabled by default in the latest version of terraform
provider google.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
@darkowlzz darkowlzz added the area/testing Testing related issues and pull requests label Nov 3, 2023
Copy link
Member

@somtochiama somtochiama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thanks for catching this.

@stefanprodan stefanprodan merged commit 9c506d6 into main Nov 3, 2023
13 checks passed
@stefanprodan stefanprodan deleted the oci-int-stop-exit-code branch November 3, 2023 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Testing related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants