Skip to content

Commit ea99e11

Browse files
Merge pull request #73 from pagopa/opex
opex dashboard
2 parents f0b54c7 + b4eab64 commit ea99e11

21 files changed

+154
-322
lines changed

.github/workflows/create_dashboard.yaml

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ name: Create Dashboard
22

33
# Controls when the workflow will run
44
on:
5-
push:
6-
branches:
7-
- main
8-
paths:
9-
- 'openapi/**'
10-
- '.github/workflows/create_dashboard.yaml'
11-
- '.opex/**'
12-
135
workflow_dispatch:
146

157
permissions:
@@ -26,6 +18,9 @@ jobs:
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

.identity/.terraform.lock.hcl

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.identity/00_data.tf

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
data "azurerm_storage_account" "tf_storage_account"{
2-
name = "pagopainfraterraform${var.env}"
3-
resource_group_name = "io-infra-rg"
4-
}
5-
6-
data "azurerm_resource_group" "dashboards" {
7-
name = "dashboards"
8-
}
9-
10-
data "azurerm_resource_group" "apim_resource_group" {
11-
name = "${local.product}-api-rg"
12-
}
13-
14-
data "azurerm_kubernetes_cluster" "aks" {
15-
name = local.aks_cluster.name
16-
resource_group_name = local.aks_cluster.resource_group_name
17-
}
18-
191
data "github_organization_teams" "all" {
202
root_teams_only = true
213
summary_only = true
224
}
235

246
data "azurerm_key_vault" "key_vault" {
25-
26-
name = "pagopa-${var.env_short}-kv"
7+
name = "pagopa-${var.env_short}-kv"
278
resource_group_name = "pagopa-${var.env_short}-sec-rg"
289
}
2910

@@ -33,36 +14,43 @@ data "azurerm_key_vault" "domain_key_vault" {
3314
}
3415

3516
data "azurerm_key_vault_secret" "key_vault_sonar" {
36-
37-
name = "sonar-token"
17+
name = "sonar-token"
3818
key_vault_id = data.azurerm_key_vault.key_vault.id
3919
}
4020

4121
data "azurerm_key_vault_secret" "key_vault_bot_token" {
42-
43-
name = "bot-token-github"
44-
key_vault_id = data.azurerm_key_vault.key_vault.id
22+
name = "pagopa-platform-domain-github-bot-cd-pat"
23+
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
4524
}
4625

47-
data "azurerm_key_vault_secret" "key_vault_cucumber_token" {
26+
data "azurerm_user_assigned_identity" "workload_identity_clientid" {
27+
name = "${local.domain}-workload-identity"
28+
resource_group_name = "pagopa-${var.env_short}-weu-${var.env}-aks-rg"
29+
}
4830

49-
name = "cucumber-token"
50-
key_vault_id = data.azurerm_key_vault.key_vault.id
31+
data "azurerm_user_assigned_identity" "identity_cd" {
32+
name = "${local.product}-${local.domain}-01-github-cd-identity"
33+
resource_group_name = "${local.product}-identity-rg"
5134
}
5235

53-
data "azurerm_key_vault_secret" "key_vault_read_package_token" {
36+
data "azurerm_key_vault_secret" "key_vault_deploy_slack_webhook" {
37+
name = "pagopa-pagamenti-deploy-slack-webhook"
38+
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
39+
}
5440

55-
name = "github-token-read-packages-bot"
56-
key_vault_id = data.azurerm_key_vault.key_vault.id
41+
data "azurerm_key_vault_secret" "key_vault_integration_test_slack_webhook" {
42+
name = "pagopa-pagamenti-integration-test-slack-webhook"
43+
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
5744
}
5845

59-
data "azurerm_user_assigned_identity" "workload_identity_clientid" {
60-
name = "apiconfig-workload-identity"
61-
resource_group_name = "pagopa-${var.env_short}-${local.location_short}-${var.env}-aks-rg"
46+
data "azurerm_key_vault_secret" "key_vault_report_slack_webhook" {
47+
name = "pagopa-pagamenti-report-slack-webhook"
48+
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
6249
}
6350

64-
data "azurerm_user_assigned_identity" "identity_cd_01" {
65-
resource_group_name = "${local.product}-identity-rg"
66-
name = "${local.product}-${local.domain}-job-01-github-cd-identity"
51+
data "azurerm_key_vault_secret" "key_vault_read_package_token" {
52+
53+
name = "github-token-read-packages-bot"
54+
key_vault_id = data.azurerm_key_vault.key_vault.id
6755
}
6856

.identity/02_application_action.tf

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)