1
0
mirror of synced 2026-02-13 13:06:56 +00:00

tests/int: Add separate resource cleanup step

Introduce a destroy-only mode in the test runner to run terraform
destroy for the respective cloud provider configurations. This can be
used to destroy cloud resources without going through the whole
provision-test process.

Add a new step in github actions workflow to run the test binary in
destoy-only mode at the very end irrespective of the result of the
previous steps. This ensures that the infrastructure is always
destroyed, even if the CI job is cancelled.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
Sunny
2024-01-08 14:35:20 +00:00
parent 1532687191
commit 94c9b13fbd
7 changed files with 60 additions and 7 deletions

View File

@@ -74,6 +74,10 @@ variables using
use the terraform configuration below. Please make sure all the requirements of
azure-gh-actions are followed before running it.
**NOTE:** When running the following for a repo under an organization, set the
environment variable `GITHUB_ORGANIZATION` if setting the `owner` in the
`github` provider doesn't work.
```hcl
provider "github" {
owner = "fluxcd"
@@ -218,7 +222,7 @@ variables using
use the terraform configuration below. Please make sure all the requirements of
gcp-gh-actions are followed before running it.
**NOTE:** When running the following for a repo under and organization, set the
**NOTE:** When running the following for a repo under an organization, set the
environment variable `GITHUB_ORGANIZATION` if setting the `owner` in the
`github` provider doesn't work.
@@ -345,8 +349,13 @@ We also pull two version of `ghcr.io/stefanprodan/podinfo` image. These images a
Container Registry and used to test `ImageRepository` and `ImageUpdateAutomation`. The terraform resources get created
and the tests are run.
**IMPORTANT:** In case the terraform infrastructure results in a bad state, maybe due to a crash during the apply,
the whole infrastructure can be destroyed by running terraform destroy in terraform/<provider> directory.
If not configured explicitly to retain the infrastructure, at the end of the
test, the test infrastructure is deleted. In case of any failure due to which
the resources don't get deleted, the `make destroy-*` commands can be run for
the respective provider. This will run terraform destroy in the respective
provider's terraform configuration directory. This can be used to quickly
destroy the infrastructure without going through the provision-test-destroy
steps.
### Debugging the tests