Skip to content

Create Dashboard

Create Dashboard #44

name: Create Dashboard
# Controls when the workflow will run
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
deployments: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
dashboard:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
strategy:
matrix:
environment: [prod]
product:
- selfcare_integration
max-parallel: 1
environment:
name: ${{ matrix.environment }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
id: checkout
# from https://github.com/actions/checkout/commits/main
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
with:
persist-credentials: false
- run: |
python -m venv venv
source venv/bin/activate
git clone --branch fix-availability-dashboard https://github.com/pagopa/opex-dashboard
cd opex-dashboard
git checkout 6c6b91d31133081d4b954e6be0a8f941e3559733
pip install -e .
cd ..
source venv/bin/activate
venv/bin/opex_dashboard generate \
--template-name azure-dashboard \
--package ./dashboard \
--config-file .opex/${{ matrix.product }}/env/${{ matrix.environment }}/config.yaml
# we need to set env variables in the folder /azure-dashboard
- name: Copy Environments
shell: bash
run: |
cp -R .opex/${{ matrix.product }}/env ./dashboard/azure-dashboard
- name: Setup Terraform
id: setup_terraform
# from https://github.com/hashicorp/setup-terraform/commits/main
uses: hashicorp/setup-terraform@8feba2b913ea459066180f9cb177f58a881cf146
with:
terraform_version: 1.3.6
- name: Login
id: login
# from https://github.com/Azure/login/commits/master
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
# now is possible to launch the command: terraform apply
- name: Terraform Apply
shell: bash
env:
ARM_CLIENT_ID: ${{ secrets.CLIENT_ID }}
ARM_TENANT_ID: ${{ secrets.TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
ARM_USE_OIDC: true
run: |
cd ./dashboard/azure-dashboard
bash ./terraform.sh apply ${{ matrix.environment }} -auto-approve
# # from https://github.com/pagopa/opex-dashboard-azure-action/
# - uses: pagopa/opex-dashboard-azure-action@v1.2.2
# with:
# environment: ${{ matrix.environment }}
# api-name: ${{ matrix.product }}
# config: .opex/${{ matrix.product }}/env/${{ matrix.environment }}/config.yaml
# client-id: ${{ secrets.CLIENT_ID }}
# tenant-id: ${{ secrets.TENANT_ID }}
# subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
# # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
# docker-version: sha256:b17f49fc762cc2049f887f0999642c95b5546d1eb44e5ae19bed080f9d1859d4