From 5c12d68382c5234240e7cbb409b4642d39f1ab82 Mon Sep 17 00:00:00 2001 From: pasqualespica <36746022+pasqualespica@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:57:09 +0200 Subject: [PATCH] alert OPEX x apim V2 --- .github/workflows/create_dashboard.yml | 40 ++----------------- .opex/{ => apim_v1}/env/prod/backend.ini | 0 .opex/{ => apim_v1}/env/prod/backend.tfvars | 0 .opex/{ => apim_v1}/env/prod/config.yaml | 0 .opex/{ => apim_v1}/env/prod/terraform.tfvars | 0 .opex/apim_v2/env/prod/backend.ini | 1 + .opex/apim_v2/env/prod/backend.tfvars | 4 ++ .opex/apim_v2/env/prod/config.yaml | 13 ++++++ .opex/apim_v2/env/prod/terraform.tfvars | 11 +++++ 9 files changed, 33 insertions(+), 36 deletions(-) rename .opex/{ => apim_v1}/env/prod/backend.ini (100%) rename .opex/{ => apim_v1}/env/prod/backend.tfvars (100%) rename .opex/{ => apim_v1}/env/prod/config.yaml (100%) rename .opex/{ => apim_v1}/env/prod/terraform.tfvars (100%) create mode 100644 .opex/apim_v2/env/prod/backend.ini create mode 100644 .opex/apim_v2/env/prod/backend.tfvars create mode 100644 .opex/apim_v2/env/prod/config.yaml create mode 100644 .opex/apim_v2/env/prod/terraform.tfvars diff --git a/.github/workflows/create_dashboard.yml b/.github/workflows/create_dashboard.yml index 1a6f8ca..918391a 100644 --- a/.github/workflows/create_dashboard.yml +++ b/.github/workflows/create_dashboard.yml @@ -26,6 +26,8 @@ jobs: strategy: matrix: environment: [prod] + product: [apim_v1, apim_v2] + max-parallel: 1 environment: name: ${{ matrix.environment }} # Steps represent a sequence of tasks that will be executed as part of the job @@ -41,44 +43,10 @@ jobs: - uses: pagopa/opex-dashboard-azure-action@v1.1.2 with: environment: ${{ matrix.environment }} - api-name: - config: .opex/env/${{ matrix.environment }}/config.yaml + 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:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d - - delete_github_deployments: - runs-on: ubuntu-latest - needs: dashboard - if: ${{ always() }} - steps: - - name: Delete Previous deployments - uses: actions/github-script@v6 - env: - SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}} - with: - script: | - const { SHA_HEAD } = process.env - - const deployments = await github.rest.repos.listDeployments({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: SHA_HEAD - }); - await Promise.all( - deployments.data.map(async (deployment) => { - await github.rest.repos.createDeploymentStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - deployment_id: deployment.id, - state: 'inactive' - }); - return github.rest.repos.deleteDeployment({ - owner: context.repo.owner, - repo: context.repo.repo, - deployment_id: deployment.id - }); - }) - ); \ No newline at end of file diff --git a/.opex/env/prod/backend.ini b/.opex/apim_v1/env/prod/backend.ini similarity index 100% rename from .opex/env/prod/backend.ini rename to .opex/apim_v1/env/prod/backend.ini diff --git a/.opex/env/prod/backend.tfvars b/.opex/apim_v1/env/prod/backend.tfvars similarity index 100% rename from .opex/env/prod/backend.tfvars rename to .opex/apim_v1/env/prod/backend.tfvars diff --git a/.opex/env/prod/config.yaml b/.opex/apim_v1/env/prod/config.yaml similarity index 100% rename from .opex/env/prod/config.yaml rename to .opex/apim_v1/env/prod/config.yaml diff --git a/.opex/env/prod/terraform.tfvars b/.opex/apim_v1/env/prod/terraform.tfvars similarity index 100% rename from .opex/env/prod/terraform.tfvars rename to .opex/apim_v1/env/prod/terraform.tfvars diff --git a/.opex/apim_v2/env/prod/backend.ini b/.opex/apim_v2/env/prod/backend.ini new file mode 100644 index 0000000..6318425 --- /dev/null +++ b/.opex/apim_v2/env/prod/backend.ini @@ -0,0 +1 @@ +subscription=PROD-pagoPA diff --git a/.opex/apim_v2/env/prod/backend.tfvars b/.opex/apim_v2/env/prod/backend.tfvars new file mode 100644 index 0000000..f55fb51 --- /dev/null +++ b/.opex/apim_v2/env/prod/backend.tfvars @@ -0,0 +1,4 @@ +resource_group_name = "io-infra-rg" +storage_account_name = "pagopainfraterraformprod" +container_name = "azurermstate" +key = "opex.pagopa-platform-authorizer-config-apimv2.terraform.tfstate" diff --git a/.opex/apim_v2/env/prod/config.yaml b/.opex/apim_v2/env/prod/config.yaml new file mode 100644 index 0000000..75d7564 --- /dev/null +++ b/.opex/apim_v2/env/prod/config.yaml @@ -0,0 +1,13 @@ +oa3_spec: ./openapi/openapi.json +name: opex_pagopa-platform-authorizer-config-apimv2 +location: West Europe +timespan: 5m +# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim +data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-weu-core-apim-v2 +resource_type: api-management +action_groups: + - /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/PagoPA + - /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/SlackPagoPA +overrides: + hosts: + - api.platform.pagopa.it \ No newline at end of file diff --git a/.opex/apim_v2/env/prod/terraform.tfvars b/.opex/apim_v2/env/prod/terraform.tfvars new file mode 100644 index 0000000..0c6c3e6 --- /dev/null +++ b/.opex/apim_v2/env/prod/terraform.tfvars @@ -0,0 +1,11 @@ +prefix = "pagopa" +env_short = "p" + + +tags = { + CreatedBy = "Terraform" + Environment = "Prod" + Owner = "pagoPA" + Source = "https://github.com/pagopa/pagopa-platform-authorizer-config" + CostCenter = "TS310 - PAGAMENTI & SERVIZI" +}