added new logic to other tests

added manual logic to e2e-upgrade.yml
This commit is contained in:
miampf 2024-03-27 15:34:15 +01:00
parent 488f12b973
commit 23814c53b8
No known key found for this signature in database
GPG Key ID: EF039364B5B6886C
4 changed files with 144 additions and 6 deletions

View File

@ -56,6 +56,7 @@ jobs:
checks: write
contents: read
packages: write
actions: write
needs: [find-latest-image]
steps:
- name: Check out repository
@ -122,20 +123,43 @@ jobs:
azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
gcpServiceAccount: "iam-e2e@constellation-e2e.iam.gserviceaccount.com"
- name: Check if tfstate should be deleted
if: always()
shell: bash
run: |
if [ ! -d constellation-terraform ] && [ ! -d constellation-iam-terraform ]; then
echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV"
else
echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV"
fi
- name: Delete tfstate artifact if necessary
if: env.DELETE_TF_STATE == 'true'
env:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/artifact_delete
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
workflowID: ${{ github.run_id }}
- name: Prepare terraform state folders
if: always()
shell: bash
run: |
rm -rf to-zip/*
to_upload=""
if [ -d constellation-terraform ]; then
cp -r constellation-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform
to_upload+="to-zip/constellation-terraform"
fi
if [ -d constellation-iam-terraform ]; then
cp -r constellation-iam-terraform to-zip
rm -rf to-zip/constellation-iam-terraform/.terraform
to_upload+=" to-zip/constellation-iam-terraform"
fi
echo "TO_UPLOAD=$to_upload" >> "$GITHUB_ENV"
- name: Update tfstate
if: always()
@ -143,8 +167,7 @@ jobs:
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
path: >
to-zip/constellation-terraform
to-zip/constellation-iam-terraform
${{ env.TO_UPLOAD }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
overwrite: true

View File

@ -303,6 +303,7 @@ jobs:
checks: write
contents: read
packages: write
actions: write
steps:
- name: Install the basics tools (macOS)
if: runner.os == 'macOS'
@ -378,20 +379,43 @@ jobs:
azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
gcpServiceAccount: "iam-e2e@constellation-e2e.iam.gserviceaccount.com"
- name: Check if tfstate should be deleted
if: always()
shell: bash
run: |
if [ ! -d constellation-terraform ] && [ ! -d constellation-iam-terraform ]; then
echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV"
else
echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV"
fi
- name: Delete tfstate artifact if necessary
if: env.DELETE_TF_STATE == 'true'
env:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/artifact_delete
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
workflowID: ${{ github.run_id }}
- name: Prepare terraform state folders
if: always()
shell: bash
run: |
rm -rf to-zip/*
to_upload=""
if [ -d constellation-terraform ]; then
cp -r constellation-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform
to_upload+="to-zip/constellation-terraform"
fi
if [ -d constellation-iam-terraform ]; then
cp -r constellation-iam-terraform to-zip
rm -rf to-zip/constellation-iam-terraform/.terraform
to_upload+=" to-zip/constellation-iam-terraform"
fi
echo "TO_UPLOAD=$to_upload" >> "$GITHUB_ENV"
- name: Update tfstate
if: always()
@ -399,8 +423,7 @@ jobs:
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
path: >
to-zip/constellation-terraform
to-zip/constellation-iam-terraform
${{ env.TO_UPLOAD }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
overwrite: true

View File

@ -309,6 +309,7 @@ jobs:
checks: write
contents: read
packages: write
actions: write
needs: [find-latest-image]
steps:
- name: Check out repository
@ -378,20 +379,43 @@ jobs:
azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
gcpServiceAccount: "iam-e2e@constellation-e2e.iam.gserviceaccount.com"
- name: Check if tfstate should be deleted
if: always()
shell: bash
run: |
if [ ! -d constellation-terraform ] && [ ! -d constellation-iam-terraform ]; then
echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV"
else
echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV"
fi
- name: Delete tfstate artifact if necessary
if: env.DELETE_TF_STATE == 'true'
env:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/artifact_delete
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
workflowID: ${{ github.run_id }}
- name: Prepare terraform state folders
if: always()
shell: bash
run: |
rm -rf to-zip/*
to_upload=""
if [ -d constellation-terraform ]; then
cp -r constellation-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform
to_upload+="to-zip/constellation-terraform"
fi
if [ -d constellation-iam-terraform ]; then
cp -r constellation-iam-terraform to-zip
rm -rf to-zip/constellation-iam-terraform/.terraform
to_upload+=" to-zip/constellation-iam-terraform"
fi
echo "TO_UPLOAD=$to_upload" >> "$GITHUB_ENV"
- name: Update tfstate
if: always()
@ -399,8 +423,7 @@ jobs:
with:
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
path: >
to-zip/constellation-terraform
to-zip/constellation-iam-terraform
${{ env.TO_UPLOAD }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
overwrite: true

View File

@ -505,6 +505,27 @@ jobs:
constellation-version.yaml
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
- name: Prepare terraform state
if: always()
shell: bash
run: |
mkdir -p to-zip
cp -r constellation-terraform to-zip
rm 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
- name: Upload terraform state
if: always()
uses: ./.github/actions/artifact_upload
with:
name: terraform-state-${{ github.run_id }}
path: >
to-zip/constellation-terraform
to-zip/constellation-iam-terraform
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
- name: Always terminate cluster
if: always()
uses: ./.github/actions/constellation_destroy
@ -523,6 +544,54 @@ jobs:
azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
gcpServiceAccount: "iam-e2e@constellation-e2e.iam.gserviceaccount.com"
- name: Check if tfstate should be deleted
if: always()
shell: bash
run: |
if [ ! -d constellation-terraform ] && [ ! -d constellation-iam-terraform ]; then
echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV"
else
echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV"
fi
- name: Delete tfstate artifact if necessary
if: env.DELETE_TF_STATE == 'true'
env:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/artifact_delete
with:
name: terraform-state-${{ github.run_id }}
workflowID: ${{ github.run_id }}
- name: Prepare terraform state folders
if: always()
shell: bash
run: |
rm -rf to-zip/*
to_upload=""
if [ -d constellation-terraform ]; then
cp -r constellation-terraform to-zip
rm to-zip/constellation-terraform/plan.zip
rm -rf to-zip/constellation-terraform/.terraform
to_upload+="to-zip/constellation-terraform"
fi
if [ -d constellation-iam-terraform ]; then
cp -r constellation-iam-terraform to-zip
rm -rf to-zip/constellation-iam-terraform/.terraform
to_upload+=" to-zip/constellation-iam-terraform"
fi
echo "TO_UPLOAD=$to_upload" >> "$GITHUB_ENV"
- name: Update tfstate
if: always()
uses: ./.github/actions/artifact_upload
with:
name: terraform-state-${{ github.run_id }}
path: >
${{ env.TO_UPLOAD }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
overwrite: true
- name: Notify about failure
if: |
always() &&