Skip to content

Commit

Permalink
add more inputs
Browse files Browse the repository at this point in the history
- add genesis hash input
- add terraform apply and destroy inputs
  • Loading branch information
DaMandal0rian committed Dec 6, 2023
1 parent 174064d commit 6ea4586
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ephemeral_devnet_aws_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
14 changes: 14 additions & 0 deletions .github/workflows/ephemeral_devnet_hetzner_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
11 changes: 7 additions & 4 deletions .github/workflows/terraform_template_ephemeral_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branch:
required: true
type: string
genesis_hash:
required: true
type: string
instance:
required: true
type: string
Expand Down Expand Up @@ -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

0 comments on commit 6ea4586

Please sign in to comment.