From 6ea4586550be7c6d7ea35d9a2d60e7c2b9e13ff1 Mon Sep 17 00:00:00 2001 From: DaMandal0rian Date: Thu, 7 Dec 2023 01:12:11 +0300 Subject: [PATCH] add more inputs - add genesis hash input - add terraform apply and destroy inputs --- .github/workflows/ephemeral_devnet_aws_deploy.yml | 14 ++++++++++++++ .../workflows/ephemeral_devnet_hetzner_deploy.yml | 14 ++++++++++++++ .../terraform_template_ephemeral_deploy.yml | 11 +++++++---- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ephemeral_devnet_aws_deploy.yml b/.github/workflows/ephemeral_devnet_aws_deploy.yml index 157aa7f..fb8f967 100644 --- a/.github/workflows/ephemeral_devnet_aws_deploy.yml +++ b/.github/workflows/ephemeral_devnet_aws_deploy.yml @@ -6,6 +6,17 @@ on: branch: required: true type: string + genesis_hash: + required: true + type: string + run_apply: + description: "The code needs to be deployed or not" + type: string + default: "no" + run_destroy: + description: "The resources need to be destroyed or not" + type: string + default: "no" pull_request: branches: - main @@ -25,11 +36,14 @@ jobs: with: project: testing-framework branch: ${{ github.event.inputs.branch }} + genesis_hash: ${{ github.event.inputs.genesis_hash }} instance: ec2 resource: network tf_workspace_name: ephemeral-devnet tf_version: 1.5.7 tf_organization: subspace + run_apply: ${{ github.event.inputs.run_apply }} + run_destroy: ${{ github.event.inputs.run_destroy }} secrets: TRANSCRYPT: ${{ secrets.TRANSCRYPT }} TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }} diff --git a/.github/workflows/ephemeral_devnet_hetzner_deploy.yml b/.github/workflows/ephemeral_devnet_hetzner_deploy.yml index 5141ea5..6fd27ee 100644 --- a/.github/workflows/ephemeral_devnet_hetzner_deploy.yml +++ b/.github/workflows/ephemeral_devnet_hetzner_deploy.yml @@ -6,6 +6,17 @@ on: branch: required: true type: string + genesis_hash: + required: true + type: string + run_apply: + description: "The code needs to be deployed or not" + type: string + default: "no" + run_destroy: + description: "The resources need to be destroyed or not" + type: string + default: "no" pull_request: branches: - main @@ -25,11 +36,14 @@ jobs: with: project: testing-framework branch: ${{ github.event.inputs.branch }} + genesis_hash: ${{ github.event.inputs.genesis_hash }} instance: hetzner resource: network tf_workspace_name: ephemeral-devnet-hetzner tf_version: 1.5.7 tf_organization: subspace + run_apply: ${{ github.event.inputs.run_apply }} + run_destroy: ${{ github.event.inputs.run_destroy }} secrets: TRANSCRYPT: ${{ secrets.TRANSCRYPT }} TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }} diff --git a/.github/workflows/terraform_template_ephemeral_deploy.yml b/.github/workflows/terraform_template_ephemeral_deploy.yml index cb77d3c..a45b218 100644 --- a/.github/workflows/terraform_template_ephemeral_deploy.yml +++ b/.github/workflows/terraform_template_ephemeral_deploy.yml @@ -9,6 +9,9 @@ on: branch: required: true type: string + genesis_hash: + required: true + type: string instance: required: true type: string @@ -82,17 +85,17 @@ jobs: if: ${{ (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform plan -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" + terraform plan -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" -var "genesis_hash=${{ inputs.genesis_hash }}" - name: Terraform Apply for ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} if: ${{ (inputs.run_apply == 'yes') && (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform apply -auto-approve -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" + terraform apply -auto-approve -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" -var "genesis_hash=${{ inputs.genesis_hash }}" - name: Terraform Destroy for ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} if: ${{ (inputs.run_destroy == 'yes') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform plan -destroy -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" - terraform destroy -auto-approve -var-file=terraform.tfvars -var "branch_name=${{ inputs.branch }}" + terraform plan -destroy -var-file=terraform.tfvars + terraform destroy -auto-approve -var-file=terraform.tfvars