mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-04-20 23:36:29 -04:00
refactor updating to new update_tfstate action
use new action in manual e2e test add token to update tfstate refactored all e2e tests to use new action
This commit is contained in:
parent
45fe56d61f
commit
75cb3c20cc
64
.github/actions/update_tfstate/action.yml
vendored
Normal file
64
.github/actions/update_tfstate/action.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Update TFState
|
||||
description: "Update the terraform state artifact."
|
||||
|
||||
inputs:
|
||||
name:
|
||||
description: "The name of the artifact that contains the tfstate."
|
||||
required: true
|
||||
runID:
|
||||
description: "The ID of your current run (github.run_id)."
|
||||
required: true
|
||||
encryptionSecret:
|
||||
description: "The encryption secret for the artifacts."
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- 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: always() && env.DELETE_TF_STATE == 'true'
|
||||
uses: ./.github/actions/artifact_delete
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
workflowID: ${{ inputs.runID }}
|
||||
|
||||
- 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: ${{ inputs.name }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
encryptionSecret: ${{ inputs.encryptionSecret }}
|
||||
overwrite: true
|
||||
|
||||
|
48
.github/workflows/e2e-test-daily.yml
vendored
48
.github/workflows/e2e-test-daily.yml
vendored
@ -123,53 +123,15 @@ 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: always() && 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()
|
||||
uses: ./.github/actions/artifact_upload
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/update_tfstate
|
||||
with:
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
runID: ${{ github.run_id }}
|
||||
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
|
||||
overwrite: true
|
||||
|
||||
- name: Notify about failure
|
||||
if: |
|
||||
|
48
.github/workflows/e2e-test-release.yml
vendored
48
.github/workflows/e2e-test-release.yml
vendored
@ -379,53 +379,15 @@ 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: always() && 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()
|
||||
uses: ./.github/actions/artifact_upload
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/update_tfstate
|
||||
with:
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
runID: ${{ github.run_id }}
|
||||
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
|
||||
overwrite: true
|
||||
|
||||
e2e-upgrade:
|
||||
strategy:
|
||||
|
48
.github/workflows/e2e-test-weekly.yml
vendored
48
.github/workflows/e2e-test-weekly.yml
vendored
@ -379,53 +379,15 @@ 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: always() && 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()
|
||||
uses: ./.github/actions/artifact_upload
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/update_tfstate
|
||||
with:
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
runID: ${{ github.run_id }}
|
||||
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
|
||||
overwrite: true
|
||||
|
||||
- name: Notify about failure
|
||||
if: |
|
||||
|
48
.github/workflows/e2e-test.yml
vendored
48
.github/workflows/e2e-test.yml
vendored
@ -280,50 +280,12 @@ 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: always() && 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()
|
||||
uses: ./.github/actions/artifact_upload
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/update_tfstate
|
||||
with:
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }}
|
||||
runID: ${{ github.run_id }}
|
||||
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
|
||||
overwrite: true
|
||||
|
48
.github/workflows/e2e-upgrade.yml
vendored
48
.github/workflows/e2e-upgrade.yml
vendored
@ -536,53 +536,15 @@ 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: always() && env.DELETE_TF_STATE == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/artifact_delete
|
||||
with:
|
||||
name: terraform-state-${{ needs.create-cluster.outputs.e2e-name-prefix }}
|
||||
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
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
uses: ./.github/actions/update_tfstate
|
||||
with:
|
||||
name: terraform-state-${{ needs.create-cluster.outputs.e2e-name-prefix }}
|
||||
path: >
|
||||
${{ env.TO_UPLOAD }}
|
||||
name: terraform-state-${{ needs.create-cluster.outputs.e2e-name-prefix }}
|
||||
runID: ${{ github.run_id }}
|
||||
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
|
||||
overwrite: true
|
||||
|
||||
- name: Notify about failure
|
||||
if: |
|
||||
|
Loading…
x
Reference in New Issue
Block a user