Skip to content

Commit

Permalink
add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Feb 5, 2024
1 parent f7db18d commit 7baaa87
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/call_release_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
environment:
type: string
required: true
tf_environment:
type: string
required: false
dir:
type: string
required: true
Expand All @@ -18,6 +21,7 @@ env:
ARM_USE_OIDC: true
ARM_USE_AZUREAD: true
ARM_STORAGE_USE_AZUREAD: true
TERRAFORM_ENVIRONMENT: ${{ inputs.tf_environment || inputs.environment }}

jobs:

Expand Down Expand Up @@ -61,15 +65,15 @@ jobs:
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
dir: ${{ inputs.dir }}
azure_environment: ${{ inputs.environment }}
azure_environment: ${{ env.TERRAFORM_ENVIRONMENT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Upload Terraform Plan as Artifact"
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: tfplan
path: ${{ inputs.dir }}/tfplan-${{ inputs.environment }}-${{ github.sha }}
path: ${{ inputs.dir }}/tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
if-no-files-found: error
retention-days: 14

Expand Down Expand Up @@ -121,10 +125,10 @@ jobs:
shell: bash
working-directory: ${{ inputs.dir }}
run: |
bash ./terraform.sh init ${{ inputs.environment }}
bash ./terraform.sh init ${{ env.TERRAFORM_ENVIRONMENT }}
- name: Terraform Apply
shell: bash
working-directory: ${{ inputs.dir }}
run: |
terraform apply -lock-timeout=3000s -auto-approve -input=false tfplan-${{ inputs.environment }}-${{ github.sha }}
terraform apply -lock-timeout=3000s -auto-approve -input=false tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
1 change: 1 addition & 0 deletions .github/workflows/release_container_apps_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- releases/*
paths:
- '!./infra/container_apps/onboarding-ms/env/**-pnpg'
- './infra/container_apps/onboarding-ms/**'

workflow_dispatch:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/release_container_apps_pnpg_infra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy PNPG Container Apps infra

on:
push:
branches:
- main
- releases/*
paths:
- './infra/container_apps/onboarding-ms/env/dev-pnpg'
- './infra/container_apps/onboarding-ms/env/uat-pnpg'
- './infra/container_apps/onboarding-ms/env/prod-pnpg'
- '!./infra/container_apps/onboarding-ms/env/**'
- './infra/container_apps/onboarding-ms/**'

workflow_dispatch:

jobs:

release_dev:
uses: ./.github/workflows/call_release_infra.yml
name: '[Dev] Container Apps Infra Release'
if: github.ref_name == 'main'
secrets: inherit
with:
environment: dev
tf_environment: dev-pnpg
dir: ./infra/container_apps/onboarding-ms
env_vars: |
TF_VAR_image_tag=sha-$(git rev-parse --short ${{ github.sha }})
release_uat:
uses: ./.github/workflows/call_release_infra.yml
name: '[UAT] Container Apps Infra Release'
if: startsWith(github.ref_name, 'releases/')
secrets: inherit
with:
environment: uat
tf_environment: uat-pnpg
dir: ./infra/container_apps/onboarding-ms
env_vars: |
TF_VAR_image_tag=sha-$(git rev-parse --short ${{ github.sha }})
release_prod:
uses: ./.github/workflows/call_release_infra.yml
name: '[Prod] Container Apps Infra Release'
if: startsWith(github.ref_name, 'releases/')
secrets: inherit
with:
environment: prod
tf_environment: prod-pnpg
dir: ./infra/container_apps/onboarding-ms
env_vars: |
TF_VAR_image_tag=sha-$(git rev-parse --short ${{ github.sha }})

0 comments on commit 7baaa87

Please sign in to comment.