@@ -2,14 +2,6 @@ name: Create Dashboard
22
33# Controls when the workflow will run
44on :
5- push :
6- branches :
7- - main
8- paths :
9- - ' openapi/**'
10- - ' .github/workflows/create_dashboard.yaml'
11- - ' .opex/**'
12-
135 workflow_dispatch :
146
157permissions :
2618 strategy :
2719 matrix :
2820 environment : [prod]
21+ product :
22+ - selfcare_integration
23+ max-parallel : 1
2924 environment :
3025 name : ${{ matrix.environment }}
3126 # Steps represent a sequence of tasks that will be executed as part of the job
@@ -37,48 +32,63 @@ jobs:
3732 with :
3833 persist-credentials : false
3934
40- # from https://github.com/pagopa/opex-dashboard-azure-action/
41- - uses : pagopa/opex-dashboard-azure-action@ece3bc2b133be74cabb50aec14cdb9b8051b886f # v1.1.2
35+ - run : |
36+ python -m venv venv
37+ source venv/bin/activate
38+ git clone --branch fix-availability-dashboard https://github.com/pagopa/opex-dashboard
39+ cd opex-dashboard
40+ git checkout 6c6b91d31133081d4b954e6be0a8f941e3559733
41+ pip install -e .
42+ cd ..
43+ source venv/bin/activate
44+ venv/bin/opex_dashboard generate \
45+ --template-name azure-dashboard \
46+ --package ./dashboard \
47+ --config-file .opex/${{ matrix.product }}/env/${{ matrix.environment }}/config.yaml
48+
49+ # we need to set env variables in the folder /azure-dashboard
50+ - name : Copy Environments
51+ shell : bash
52+ run : |
53+ cp -R .opex/${{ matrix.product }}/env ./dashboard/azure-dashboard
54+
55+ - name : Setup Terraform
56+ id : setup_terraform
57+ # from https://github.com/hashicorp/setup-terraform/commits/main
58+ uses : hashicorp/setup-terraform@8feba2b913ea459066180f9cb177f58a881cf146
59+ with :
60+ terraform_version : 1.3.6
61+
62+ - name : Login
63+ id : login
64+ # from https://github.com/Azure/login/commits/master
65+ uses : azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
4266 with :
43- environment : ${{ matrix.environment }}
44- api-name :
45- config : .opex/env/${{ matrix.environment }}/config.yaml
4667 client-id : ${{ secrets.CLIENT_ID }}
4768 tenant-id : ${{ secrets.TENANT_ID }}
4869 subscription-id : ${{ secrets.SUBSCRIPTION_ID }}
49- # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
50- docker-version : sha256:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d
5170
52- delete_github_deployments :
53- runs-on : ubuntu-latest
54- needs : dashboard
55- if : ${{ always() }}
56- steps :
57- - name : Delete Previous deployments
58- uses : actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
71+ # now is possible to launch the command: terraform apply
72+ - name : Terraform Apply
73+ shell : bash
5974 env :
60- SHA_HEAD : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}}
61- with :
62- script : |
63- const { SHA_HEAD } = process.env
75+ ARM_CLIENT_ID : ${{ secrets.CLIENT_ID }}
76+ ARM_TENANT_ID : ${{ secrets.TENANT_ID }}
77+ ARM_SUBSCRIPTION_ID : ${{ secrets.SUBSCRIPTION_ID }}
78+ ARM_USE_OIDC : true
79+ run : |
80+ cd ./dashboard/azure-dashboard
81+
82+ bash ./terraform.sh apply ${{ matrix.environment }} -auto-approve
6483
65- const deployments = await github.rest.repos.listDeployments({
66- owner: context.repo.owner,
67- repo: context.repo.repo,
68- sha: SHA_HEAD
69- });
70- await Promise.all(
71- deployments.data.map(async (deployment) => {
72- await github.rest.repos.createDeploymentStatus({
73- owner: context.repo.owner,
74- repo: context.repo.repo,
75- deployment_id: deployment.id,
76- state: 'inactive'
77- });
78- return github.rest.repos.deleteDeployment({
79- owner: context.repo.owner,
80- repo: context.repo.repo,
81- deployment_id: deployment.id
82- });
83- })
84- );
84+ # # from https://github.com/pagopa/opex-dashboard-azure-action/
85+ # - uses: pagopa/opex-dashboard-azure-action@v1.2.2
86+ # with:
87+ # environment: ${{ matrix.environment }}
88+ # api-name: ${{ matrix.product }}
89+ # config: .opex/${{ matrix.product }}/env/${{ matrix.environment }}/config.yaml
90+ # client-id: ${{ secrets.CLIENT_ID }}
91+ # tenant-id: ${{ secrets.TENANT_ID }}
92+ # subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
93+ # # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
94+ # docker-version: sha256:b17f49fc762cc2049f887f0999642c95b5546d1eb44e5ae19bed080f9d1859d4
0 commit comments