diff --git a/.github/workflows/call_release_infra.yml b/.github/workflows/call_release_infra.yml index 177c6fb82..a73c07174 100644 --- a/.github/workflows/call_release_infra.yml +++ b/.github/workflows/call_release_infra.yml @@ -4,6 +4,9 @@ on: environment: type: string required: true + tf_environment: + type: string + required: false dir: type: string required: true @@ -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: @@ -61,7 +65,7 @@ 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 }} @@ -69,7 +73,7 @@ jobs: 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 @@ -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 }} diff --git a/.github/workflows/release_container_apps_infra.yml b/.github/workflows/release_container_apps_infra.yml index b3adb39c1..abb5ffe03 100644 --- a/.github/workflows/release_container_apps_infra.yml +++ b/.github/workflows/release_container_apps_infra.yml @@ -6,6 +6,7 @@ on: - main - releases/* paths: + - '!./infra/container_apps/onboarding-ms/env/**-pnpg' - './infra/container_apps/onboarding-ms/**' workflow_dispatch: diff --git a/.github/workflows/release_container_apps_pnpg_infra.yml b/.github/workflows/release_container_apps_pnpg_infra.yml new file mode 100644 index 000000000..3fcca85cf --- /dev/null +++ b/.github/workflows/release_container_apps_pnpg_infra.yml @@ -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 }}) \ No newline at end of file