Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOD-855] Deploy dev for Nexi Postgres #60

Merged
merged 42 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4172658
helm and apim
aomegax Apr 23, 2024
3a6c815
fix deploy pipeline
aomegax Apr 23, 2024
f74bda0
readinessProbe
aomegax Apr 29, 2024
4524ad1
fix liveness time
aomegax Apr 29, 2024
a9ef732
Bump to version 0.9.7-1-NOD-855-deploy-dev [skip ci]
pagopa-github-bot Apr 29, 2024
3ecefa5
fix pipeline
aomegax May 2, 2024
ee2d4ed
fix openapi
aomegax May 2, 2024
5e78862
fix deploy_with_gh_runner
aomegax May 2, 2024
876743c
fix deploy_with_gh_runner
aomegax May 2, 2024
b254b54
fix deploy_with_gh_runner
aomegax May 2, 2024
415e893
fix deploy_with_gh_runner
aomegax May 2, 2024
1222018
fix deploy_with_gh_runner - test
aomegax May 2, 2024
5d3fa51
fix deploy_with_gh_runner - test
aomegax May 2, 2024
61e3838
fix deploy_with_gh_runner - test
aomegax May 2, 2024
0ec6bb4
fix deploy_with_gh_runner - test
aomegax May 2, 2024
b705d1a
fix deploy_with_gh_runner - test
aomegax May 2, 2024
d56ddbf
fix deploy_with_gh_runner - test
aomegax May 2, 2024
1b73be2
fix deploy_with_gh_runner - test
aomegax May 2, 2024
92ff012
fix deploy_with_gh_runner
aomegax May 2, 2024
7bfc4c6
Bump to version 0.9.7-2-NOD-855-deploy-dev [skip ci]
pagopa-github-bot May 2, 2024
071af00
fix deploy_with_gh_runner - test
aomegax May 2, 2024
4a9aa09
fix
aomegax May 2, 2024
55fcddf
fix
aomegax May 2, 2024
ceb0066
fix
aomegax May 2, 2024
3cf5395
fix
aomegax May 2, 2024
dc70501
fix
aomegax May 2, 2024
42afd2b
fix
aomegax May 2, 2024
f35fed3
fix
aomegax May 3, 2024
921e0c8
fix
aomegax May 3, 2024
a39b951
fix
aomegax May 3, 2024
89823ff
fix
aomegax May 3, 2024
1c042a0
fix
aomegax May 3, 2024
8aa1d0d
Bump to version 0.9.7-3-NOD-855-deploy-dev [skip ci]
pagopa-github-bot May 3, 2024
92e700c
fix test
aomegax May 3, 2024
5049b76
Merge branch 'NOD-855-deploy-dev' of github.com:pagopa/pagopa-api-con…
aomegax May 3, 2024
1cd5ca7
fix
aomegax May 3, 2024
030cfa2
fix
aomegax May 3, 2024
c6d0611
setting Rome timezone
aomegax May 6, 2024
684ced0
Bump to version 0.9.7-4-NOD-855-deploy-dev [skip ci]
pagopa-github-bot May 6, 2024
62b6bba
specified SEND_EVENT: "false"
aomegax May 7, 2024
7292b1d
Merge branch 'NOD-855-deploy-dev' of github.com:pagopa/pagopa-api-con…
aomegax May 7, 2024
9e4e435
Bump to version 0.9.7-5-NOD-855-deploy-dev [skip ci]
pagopa-github-bot May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 101 additions & 12 deletions .github/workflows/deploy_with_github_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,44 @@ on:
env:
APP_NAME: cache


permissions:
id-token: write
contents: read

jobs:
setting_env:
name: Setting Environment
runs-on: ubuntu-22.04
if: ${{ inputs.target == inputs.environment }}
outputs:
environment: ${{ steps.get_env.outputs.environment }}
steps:
- name: Get Environment
id: get_env
shell: bash
run: |
current_env="dev"
if [[ "${{ inputs.environment }}" == *"nexi"* ]]; then
if [[ "${{ inputs.environment }}" == *"dev"* ]]; then
current_env="dev"
elif [[ "${{ inputs.environment }}" == *"sit"* ]]; then
current_env="dev"
else
current_env="uat"
fi
elif [[ "${{ inputs.environment }}" == "prf" ]]; then
current_env="uat"
else
current_env="${{ inputs.environment }}"
fi
echo "environment=$current_env" >> $GITHUB_OUTPUT

create_runner:
needs: [ setting_env ]
name: Create Runner
runs-on: ubuntu-22.04
environment:
name: ${{ inputs.environment }}
name: ${{ needs.setting_env.outputs.environment }}
if: ${{ inputs.target == inputs.environment }}
outputs:
runner_name: ${{ steps.create_github_runner.outputs.runner_name }}
Expand All @@ -43,32 +70,94 @@ jobs:
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}

deploy:
needs: [ create_runner ]
needs: [ setting_env, create_runner ]
runs-on: [ self-hosted, "${{ needs.create_runner.outputs.runner_name }}" ]
if: ${{ inputs.target == inputs.environment }}
name: Deploy on AKS
environment: ${{ inputs.environment }}
environment: ${{ needs.setting_env.outputs.environment }}
steps:
- name: Deploy

- name: Deploy DEV for PagoPA (Oracle or Postgres)
uses: pagopa/github-actions-template/aks-deploy@5db4c9108164a07d96527978da1c3febec934f22 #v1.11.1
if: ${{ inputs.environment == 'dev' }}
with:
branch: ${{ github.ref_name }}
client_id: ${{ secrets.CD_CLIENT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
env: ${{ needs.setting_env.outputs.environment }}
namespace: ${{ vars.NAMESPACE }}
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}
helm_upgrade_options: ' --debug --set postgresql.enabled=true --set postgresql.forceRedeploy=true --set postgresql-replica.forceRedeploy=false --set postgresql-nexi.forceRedeploy=false --set oracle.enabled=true --set oracle.forceRedeploy=true --set oracledev.enabled=true --set oracledev.forceRedeploy=false --set oracleprod.enabled=true --set oracleprod.forceRedeploy=false'

- name: Deploy UAT for PagoPA (Oracle or Postgres)
uses: pagopa/github-actions-template/aks-deploy@5db4c9108164a07d96527978da1c3febec934f22 #v1.11.1
if: ${{ inputs.environment == 'uat' }}
with:
branch: ${{ github.ref_name }}
client_id: ${{ secrets.CD_CLIENT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
env: ${{ needs.setting_env.outputs.environment }}
namespace: ${{ vars.NAMESPACE }}
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}
helm_upgrade_options: ' --debug --set postgresql.enabled=true --set oracle.enabled=true'

- name: Deploy PRF for PagoPA (Oracle or Postgres)
uses: pagopa/github-actions-template/aks-deploy@5db4c9108164a07d96527978da1c3febec934f22 #v1.11.1
if: ${{ inputs.environment == 'prf' }}
with:
branch: ${{ github.ref_name }}
client_id: ${{ secrets.CD_CLIENT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
env: ${{ needs.setting_env.outputs.environment }}
namespace: ${{ vars.NAMESPACE }}
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}
helm_upgrade_options: ' --debug --set postgresql-replica.enabled=true --set oracledev.enabled=true '

- name: Deploy PROD for PagoPA (Oracle or Postgres)
uses: pagopa/github-actions-template/aks-deploy@5db4c9108164a07d96527978da1c3febec934f22 #v1.11.1
if: ${{ inputs.environment == 'prod' }}
with:
branch: ${{ github.ref_name }}
client_id: ${{ secrets.CD_CLIENT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
env: ${{ needs.setting_env.outputs.environment }}
namespace: ${{ vars.NAMESPACE }}
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}
helm_upgrade_options: ' --debug --set postgresql.enabled=true --set oracle.enabled=true'

- name: Deploy for Nexi
uses: pagopa/github-actions-template/aks-deploy@main
if: ${{ inputs.environment == 'dev_nexi' || inputs.environment == 'sit_nexi' || inputs.environment == 'uat_nexi' || inputs.environment == 'prf_nexi' }}
with:
branch: ${{ github.ref_name }}
client_id: ${{ secrets.CD_CLIENT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
env: ${{ inputs.environment }}
env: ${{ needs.setting_env.outputs.environment }}
namespace: ${{ vars.NAMESPACE }}
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}
helm_upgrade_options: ${{ inputs.environment == 'dev' && ' --debug --set postgresql.enabled=true --set oracle.enabled=true --set oracledev.enabled=true --set oracleprod.enabled=true' || inputs.environment == 'uat' && ' --debug --set postgresql.enabled=true --set oracle.enabled=true --set oracledev.enabled=true ' || ' --debug --set postgresql.enabled=true --set oracle.enabled=true' }}
helm_upgrade_options: ${{ (inputs.environment == 'dev_nexi') && ' --debug --set oracledev.enabled=true --set oracledev.forceRedeploy=true --set oracleprod.enabled=true --set oracleprod.forceRedeploy=false' || (inputs.environment == 'sit_nexi' || inputs.environment == 'uat_nexi') && ' --debug --set postgresql-nexi.enabled=true --set postgresql-nexi.forceRedeploy=true' || inputs.environment == 'prf_nexi' && ' --debug --set postgresql-replica-nexi.enabled=true --set postgresql-replica-nexi.forceRedeploy=true' }}

cleanup_runner:
name: Cleanup Runner
needs: [ create_runner, deploy ]
needs: [ setting_env, create_runner, deploy ]
if: ${{ success() || failure() && inputs.target == inputs.environment }}
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
environment: ${{ needs.setting_env.outputs.environment }}
steps:
- name: Cleanup GitHub Runner
id: cleanup_github_runner
Expand All @@ -83,11 +172,11 @@ jobs:
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}

update_openapi:
needs: [ deploy ]
needs: [ setting_env, deploy ]
runs-on: ubuntu-latest
name: Update OpenAPI
if: ${{ inputs.target == inputs.environment }}
environment: ${{ inputs.environment }}
environment: ${{ needs.setting_env.outputs.environment }}
steps:
- name: Checkout
id: checkout
Expand All @@ -113,5 +202,5 @@ jobs:
client_id: "${{ secrets.CD_CLIENT_ID }}"
tenant_id: "${{ secrets.TENANT_ID }}"
subscription_id: "${{ secrets.SUBSCRIPTION_ID }}"
tf_environment: "weu-${{ inputs.environment }}"
tf_environment: "weu-${{ needs.setting_env.outputs.environment }}"
dir: "infra"
17 changes: 12 additions & 5 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ on:
options:
- dev
- uat
- prf
- prod
- dev_nexi
- sit_nexi
- uat_nexi
- prf_nexi
beta:
required: false
type: boolean
Expand Down Expand Up @@ -74,14 +79,14 @@ jobs:
run: echo "semver=${{env.SEMVER}}" >> $GITHUB_OUTPUT

# Set Environment
- run: echo "ENVIRNOMENT=${{ inputs.environment}}" >> $GITHUB_ENV
- run: echo "ENVIRONMENT=${{ inputs.environment}}" >> $GITHUB_ENV

- if: ${{ inputs.environment == null }}
run: echo "ENVIRNOMENT=dev" >> $GITHUB_ENV
run: echo "ENVIRONMENT=dev" >> $GITHUB_ENV

- id: get_env
name: Set Output
run: echo "environment=${{env.ENVIRNOMENT}}" >> $GITHUB_OUTPUT
run: echo "environment=${{env.ENVIRONMENT}}" >> $GITHUB_OUTPUT


release:
Expand All @@ -104,7 +109,8 @@ jobs:
needs: [ setup, release ]
name: Build and Push Docker Image
runs-on: ubuntu-latest
if: ${{ inputs.semver != 'skip' }}
# if: ${{ inputs.semver != 'skip' }}
if: ${{ needs.setup.outputs.semver != 'skip' }}
steps:
# - name: Build and Push
# id: semver
Expand Down Expand Up @@ -145,13 +151,14 @@ jobs:
secrets: |
GH_TOKEN=${{ secrets.READ_PACKAGES_TOKEN }}


deploy_aks:
name: Deploy on AKS
needs: [ setup, release, image ]
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
strategy:
matrix:
environment: [ dev, uat, prod ]
environment: [ dev, uat, prf, prod, dev_nexi, sit_nexi, uat_nexi, prf_nexi ]
uses: ./.github/workflows/deploy_with_github_runner.yml
with:
environment: ${{ matrix.environment }}
Expand Down
68 changes: 51 additions & 17 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,90 @@ apiVersion: v2
name: pagopa-api-cache-chart
description: Microservice that handles calculation for pagoPA Advanced Fees Management
type: application
version: 0.65.0
version: 0.70.0
dependencies:
##############
## POSTGRES ##
## PAGOPA ##
##############
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql
alias: postgresql # postgres pagopa
condition: postgresql.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql-replica
alias: postgresql-replica # postgres pagopa
condition: postgresql-replica.enabled
# CRON
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p # postgres pagopa
condition: postgresql.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p-replica # postgres pagopa
condition: postgresql-replica.enabled
##############
## ORACLE ##
## NEXI ##
##############
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: oracle
alias: oracle # oracle nexi (sit, uat, prod)
condition: oracle.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: oracledev
alias: oracledev # oracle nexi (dev o prf)
condition: oracledev.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: oracleprod
alias: oracleprod # oracle nexi (prod in dev per test)
condition: oracleprod.enabled
# CRON
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p
condition: postgresql.enabled
alias: refresh-o # oracle nexi (sit, uat, prod)
condition: oracle.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-p-replica
condition: postgresql-replica.enabled
alias: refresh-odev # oracle nexi (dev o prf)
condition: oracledev.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-o
condition: oracle.enabled
alias: refresh-oprod # oracle nexi (prod in dev per test)
condition: oracleprod.enabled
##############
## POSTGRES ##
## NEXI ##
##############
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql-nexi # postgres nexi
condition: postgresql-nexi.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-odev
condition: oracledev.enabled
alias: refresh-p-nexi # postgres nexi
condition: postgresql-nexi.enabled
- name: microservice-chart
version: 3.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
alias: postgresql-replica-nexi # postgres prf nexi
condition: postgresql-replica-nexi.enabled
- name: cron-chart
version: 2.6.0
repository: "https://pagopa.github.io/aks-cron-chart-blueprint"
alias: refresh-oprod
condition: oracleprod.enabled
appVersion: 0.9.7
alias: refresh-p-replica-nexi # postgres prf nexi
condition: postgresql-replica-nexi.enabled
appVersion: 0.9.7-5-NOD-855-deploy-dev
Loading