update state with remote state and dont error on failed downloads (eg if artifact doesnt exist)

This commit is contained in:
miampf 2024-02-26 16:31:17 +01:00
parent 04fc6e6221
commit 782a096e6b
No known key found for this signature in database
GPG Key ID: EF039364B5B6886C

View File

@ -8,13 +8,14 @@ function get_e2e_test_ids_on_date {
# download_tfstate_artifact downloads all artifacts matching the pattern terraform-state-* from a given workflow ID.
function download_tfstate_artifact {
gh run download "$1" -p "terraform-state-*" -R edgelesssys/constellation > /dev/null || exit 1
gh run download "$1" -p "terraform-state-*" -R edgelesssys/constellation > /dev/null
}
# delete_resources runs terraform destroy on the constellation-terraform subfolder of a given folder.
function delete_resources {
cd "$1/constellation-terraform" || exit 1
terraform init > /dev/null || exit 1 # first, install plugins
terraform state pull > terraform.tfstate || exit 1 # update the local state with the remote state to only have resources over that have to be cleaned up.
terraform destroy -auto-approve > /dev/null || exit 1
cd ../../ || exit 1
}
@ -23,6 +24,7 @@ function delete_resources {
function delete_iam_config {
cd "$1/constellation-iam-terraform" || exit 1
terraform init > /dev/null || exit 1 # first, install plugins
terraform state pull > terraform.tfstate || exit 1 # update the local state with the remote state to only have resources over that have to be cleaned up.
terraform destroy -auto-approve > /dev/null || exit 1
cd ../../ || exit 1
}