mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
a15cf54477
* Use 7zip for creating and processing encrypted archives * Switch to .7z file extension * Fix shell check issues * Fix tfstate update logic --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems>
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
name: Update TFState
|
|
description: "Update the terraform state artifact. We use this to either delete an artifact if the e2e test was cleaned up successfully or to update the artifact with the latest terraform state."
|
|
|
|
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 uploaded tfstate can 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 left over terraform state folders
|
|
if: always() && env.DELETE_TF_STATE == 'false'
|
|
shell: bash
|
|
run: |
|
|
rm -rf to-zip/*
|
|
mkdir -p to-zip
|
|
|
|
to_upload=""
|
|
if [[ -d constellation-terraform ]]; then
|
|
cp -r constellation-terraform to-zip
|
|
rm -f 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() && env.TO_UPLOAD != ''
|
|
uses: ./.github/actions/artifact_upload
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: >
|
|
${{ env.TO_UPLOAD }}
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|
|
overwrite: true
|