ci: fix delete artifact conditional (#3067)

* Fix state exists check
* Dont fail if folder to remove does not exist

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2024-05-07 08:48:38 +02:00 committed by GitHub
parent 012937740f
commit edc0c7068e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -262,7 +262,7 @@ runs:
mkdir to-zip
cp -r constellation-terraform to-zip
cp -r constellation-iam-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -f to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform to-zip/constellation-iam-terraform/.terraform
- name: Upload terraform state

View File

@ -23,7 +23,7 @@ runs:
if: always() && inputs.skipDeletion == 'false'
shell: bash
run: |
if [[ ! -d constellation-terraform ]] && [[ ! -d constellation-iam-terraform ]]; then
if [[ -d constellation-terraform ]] || [[ -d constellation-iam-terraform ]]; then
echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV"
else
echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV"

View File

@ -23,4 +23,4 @@ runs:
- name: Cleanup Terraform module dir
shell: bash
run: |
rm -r terraform-module terraform-module.zip
rm -f terraform-module terraform-module.zip

View File

@ -513,7 +513,7 @@ jobs:
run: |
mkdir -p to-zip
cp -r constellation-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -f to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform
cp -r constellation-iam-terraform to-zip
rm -rf to-zip/constellation-iam-terraform/.terraform
@ -542,7 +542,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/update_tfstate
with:
name: terraform-state-${{ needs.create-cluster.outputs.e2e-name-prefix }}
name: terraform-state-${{ needs.create-cluster.outputs.e2e-name-prefix }}
runID: ${{ github.run_id }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}