Skip to content

Commit 067002c

Browse files
authored
Add workflows for PSN terraform validate/release and functions deploy (#592)
This pull request introduces two new GitHub Actions workflows to automate the planning and release processes for PSN infrastructure changes in the production environment. The workflows detect changes in specific infrastructure directories and trigger appropriate plan or release jobs, supporting both manual and automatic triggers. Add also a workflow for all functions deploy. Resolves: CES-1487
1 parent 4a8a22e commit 067002c

File tree

5 files changed

+224
-0
lines changed

5 files changed

+224
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: PR PSN Infrastructure Release - Prod
2+
3+
on:
4+
workflow_dispatch:
5+
# TBD: Uncomment after permissions are set on identity
6+
# push:
7+
# branches:
8+
# - master
9+
# paths:
10+
# - "infra/core/psn/hub/prod/**"
11+
# - "infra/core/psn/spoke/prod/**"
12+
# - "infra/resources/psn/prod/**"
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
id-token: write
18+
19+
concurrency:
20+
group: ${{ github.workflow }}
21+
cancel-in-progress: false
22+
23+
jobs:
24+
changes:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
changes: ${{ steps.changes.outputs.changes || steps.all.outputs.changes }}
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
31+
if: github.event_name != 'workflow_dispatch'
32+
33+
- name: Found changed PSN Infra modules
34+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
35+
if: github.event_name != 'workflow_dispatch'
36+
id: changes
37+
with:
38+
filters: |
39+
core/psn/hub:
40+
- 'infra/core/psn/hub/prod/**'
41+
core/psn/spoke:
42+
- 'infra/core/psn/spoke/prod/**'
43+
resources/psn:
44+
- 'infra/resources/psn/prod/**'
45+
46+
- name: All PSN Infra modules (for manual trigger)
47+
if: github.event_name == 'workflow_dispatch'
48+
id: all
49+
run: |
50+
echo 'changes=["core/psn/hub", "core/psn/spoke", "resources/psn"]' >> $GITHUB_OUTPUT
51+
52+
release_prod:
53+
needs: changes
54+
uses: pagopa/dx/.github/workflows/infra_apply.yaml@support/psn-adaptation #main - Temporary, to be removed when using specific psn environment
55+
name: Infrastructure Release
56+
secrets: inherit
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
infra: ${{ fromJSON( needs.changes.outputs.changes ) }}
62+
63+
with:
64+
environment: prod
65+
base_path: infra/${{ matrix.infra }}
66+
use_private_agent: true
67+
override_github_environment: infra-prod
68+
use_labels: true
69+
override_labels: psn
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy Function App PSN (support-func)
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "apps/io-wallet-support-func/CHANGELOG.md"
10+
11+
permissions:
12+
attestations: write
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
deploy:
18+
name: Deploy
19+
uses: pagopa/dx/.github/workflows/release-azure-appsvc-v1.yaml@support/psn-adaptation #main - Temporary, to be removed when using specific psn environment
20+
secrets: inherit
21+
with:
22+
workspace_name: io-wallet-support-func
23+
environment: app-prod
24+
resource_group_name: iw-p-itn-wallet-rg-01
25+
web_app_name: iw-p-itn-support-func-01
26+
disable_auto_staging_deploy: true
27+
use_labels: true
28+
override_labels: psn
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy Function App PSN (user-func)
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "apps/io-wallet-user-func/CHANGELOG.md"
10+
11+
permissions:
12+
attestations: write
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
deploy:
18+
name: Deploy
19+
uses: pagopa/dx/.github/workflows/release-azure-appsvc-v1.yaml@support/psn-adaptation #main - Temporary, to be removed when using specific psn environment
20+
secrets: inherit
21+
with:
22+
workspace_name: io-wallet-user-func
23+
environment: app-prod
24+
resource_group_name: iw-p-itn-wallet-rg-01
25+
web_app_name: iw-p-itn-user-func-01
26+
disable_auto_staging_deploy: true
27+
use_labels: true
28+
override_labels: psn
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy Function App PSN (user-uat-func)
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "apps/io-wallet-user-func/CHANGELOG.md"
10+
11+
permissions:
12+
attestations: write
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
deploy:
18+
name: Deploy
19+
uses: pagopa/dx/.github/workflows/release-azure-appsvc-v1.yaml@support/psn-adaptation #main - Temporary, to be removed when using specific psn environment
20+
secrets: inherit
21+
with:
22+
workspace_name: io-wallet-user-func
23+
environment: app-prod
24+
resource_group_name: iw-p-itn-wallet-rg-01
25+
web_app_name: iw-u-itn-user-func-01
26+
disable_auto_staging_deploy: true
27+
use_labels: true
28+
override_labels: psn
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: PR PSN Infrastructure Plan - Prod
2+
3+
on:
4+
workflow_dispatch:
5+
# TBD: Uncomment after permissions are set on identity
6+
# pull_request:
7+
# types:
8+
# - opened
9+
# - edited
10+
# - synchronize
11+
# - reopened
12+
# - ready_for_review
13+
# paths:
14+
# - "infra/core/psn/hub/prod/**"
15+
# - "infra/core/psn/spoke/prod/**"
16+
# - "infra/resources/psn/prod/**"
17+
# - ".github/workflows/pr_psn_infra.yaml"
18+
19+
permissions:
20+
contents: read
21+
pull-requests: write
22+
id-token: write
23+
24+
concurrency:
25+
group: ${{ github.workflow }}
26+
cancel-in-progress: false
27+
28+
jobs:
29+
changes:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
changes: ${{ steps.changes.outputs.changes || steps.all.outputs.changes }}
33+
steps:
34+
- name: Found changed PSN Infra modules
35+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
36+
if: github.event_name != 'workflow_dispatch'
37+
id: changes
38+
with:
39+
filters: |
40+
core/psn/hub:
41+
- 'infra/core/psn/hub/prod/**'
42+
core/psn/spoke:
43+
- 'infra/core/psn/spoke/prod/**'
44+
resources/psn:
45+
- 'infra/resources/psn/prod/**'
46+
47+
- name: All PSN Infra modules (for manual trigger)
48+
if: github.event_name == 'workflow_dispatch'
49+
id: all
50+
run: |
51+
echo 'changes=["core/psn/hub", "core/psn/spoke", "resources/psn"]' >> $GITHUB_OUTPUT # removed for tests
52+
53+
plan_prod:
54+
needs: changes
55+
uses: pagopa/dx/.github/workflows/infra_plan.yaml@support/psn-adaptation #main - Temporary, to be removed when using specific psn environment
56+
name: Infrastructure Plan
57+
secrets: inherit
58+
59+
strategy:
60+
fail-fast: false
61+
max-parallel: 1
62+
matrix:
63+
infra: ${{ fromJSON( needs.changes.outputs.changes ) }}
64+
65+
with:
66+
environment: prod
67+
base_path: infra/${{ matrix.infra }}
68+
use_private_agent: true
69+
override_github_environment: infra-prod
70+
use_labels: true
71+
override_labels: psn

0 commit comments

Comments
 (0)