From c05d4d60def920c6b0fe4e71ea9b9560212b336b Mon Sep 17 00:00:00 2001 From: Jacopo Date: Wed, 9 Aug 2023 13:03:05 +0200 Subject: [PATCH 01/11] [PAGOPA-1135] new GHA --- .devops/code-review-pipelines.yml | 67 ----- .github/workflows/anchore.yml | 8 +- .github/workflows/check_pr.yml | 143 ++++----- .github/workflows/code_review.yml | 141 +++++---- .github/workflows/create_dashboard.yaml | 85 +++--- .github/workflows/deploy_aks.yml | 272 ------------------ .../workflows/deploy_with_github_runner.yml | 125 ++++++++ .github/workflows/release_deploy.yml | 148 ++++++++++ .github/workflows/update_code.yml | 55 +++- 9 files changed, 507 insertions(+), 537 deletions(-) delete mode 100644 .devops/code-review-pipelines.yml delete mode 100644 .github/workflows/deploy_aks.yml create mode 100644 .github/workflows/deploy_with_github_runner.yml create mode 100644 .github/workflows/release_deploy.yml diff --git a/.devops/code-review-pipelines.yml b/.devops/code-review-pipelines.yml deleted file mode 100644 index c4a2b3a7..00000000 --- a/.devops/code-review-pipelines.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Maven -# Build your Java project and run tests with Apache Maven. -# Add steps that analyze code, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/java - -# Automatically triggered on PR -# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#pr-trigger -trigger: - - main -pr: - - main - -pool: - vmImage: 'ubuntu-20.04' - -variables: - MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository - MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - GITHUB_TOKEN_READ_PACKAGES_SECRET: '$(github_token_read_packages_dev)' - -steps: - - bash: | - echo "##vso[task.setvariable variable=GITHUB_TOKEN_READ_PACKAGES]$(GITHUB_TOKEN_READ_PACKAGES_SECRET)" - - task: Cache@2 - inputs: - key: 'maven | "$(Agent.OS)" | pom.xml' - restoreKeys: | - maven | "$(Agent.OS)" - maven - path: $(MAVEN_CACHE_FOLDER) - displayName: Cache Maven local repo - - - task: SonarCloudPrepare@1 - displayName: 'Prepare SonarCloud analysis configuration' - inputs: - SonarCloud: '$(SONARCLOUD_SERVICE_CONN)' - organization: '$(SONARCLOUD_ORG)' - scannerMode: Other - extraProperties: | - sonar.projectKey=$(SONARCLOUD_PROJECT_KEY) - sonar.projectName=$(SONARCLOUD_PROJECT_NAME) - sonar.projectVersion=$(Build.BuildNumber) - sonar.sources=src/main/java - sonar.tests=src/test/java - sonar.coverage.exclusions=**/imported/** - - task: Maven@3 - displayName: 'Run Junit Test' - inputs: - mavenPomFile: 'pom.xml' - goals: 'clean test' - publishJUnitResults: true - testResultsFiles: '**/surefire-reports/TEST-*.xml' - codeCoverageToolOption: 'JaCoCo' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - mavenVersionOption: 'Default' - mavenOptions: '-Xmx3072m $(MAVEN_OPTS)' - mavenAuthenticateFeed: false - effectivePomSkip: false - sonarQubeRunAnalysis: true - isJacocoCoverageReportXML: false - sqMavenPluginVersionChoice: 'latest' - - - task: SonarCloudPublish@1 - displayName: 'Publish SonarCloud results on build summary' - inputs: - pollingTimeoutSec: '300' diff --git a/.github/workflows/anchore.yml b/.github/workflows/anchore.yml index e4c73ed5..802f6267 100644 --- a/.github/workflows/anchore.yml +++ b/.github/workflows/anchore.yml @@ -25,7 +25,6 @@ permissions: env: DOCKERFILE: Dockerfile - GITHUB_TOKEN_READ_PACKAGES: ${{ secrets.GITHUB_TOKEN }} jobs: Anchore-Build-Scan: @@ -39,18 +38,17 @@ jobs: uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file ${{ env.DOCKERFILE }} --tag localbuild/testimage:latest --build-arg github_token=${{ env.GITHUB_TOKEN_READ_PACKAGES }} + run: docker build . --file ${{ env.DOCKERFILE }} --tag localbuild/testimage:latest - name: Run the Anchore scan action itself with GitHub Advanced Security code scanning integration enabled - id: scan uses: anchore/scan-action@v3 with: image: "localbuild/testimage:latest" - output-format: sarif + acs-report-enable: true fail-build: true severity-cutoff: "high" - name: Upload Anchore Scan Report uses: github/codeql-action/upload-sarif@v2 if: always() with: - sarif_file: ${{ steps.scan.outputs.sarif }} + sarif_file: results.sarif diff --git a/.github/workflows/check_pr.yml b/.github/workflows/check_pr.yml index d77e4998..cce975c6 100644 --- a/.github/workflows/check_pr.yml +++ b/.github/workflows/check_pr.yml @@ -28,56 +28,23 @@ jobs: with: configuration-path: '.github/auto_assign.yml' - check_labels: - name: Check Required Labels - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Verify PR Labels - if: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking-change') && !contains(github.event.pull_request.labels.*.name, 'enhancement') && !contains(github.event.pull_request.labels.*.name, 'bug') && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release') }} - uses: actions/github-script@v6.3.3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - var comments = await github.rest.issues.listComments({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }); - for (const comment of comments.data) { - if (comment.body.includes('This pull request does not contain a valid label')){ - github.rest.issues.deleteComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: comment.id - }) - } - } - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'This pull request does not contain a valid label. Please add one of the following labels: `[bug, enhancement, breaking-change, ignore-for-release]`' - }) - core.setFailed('Missing required labels') - - check_format: name: Check Format runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 + - name: Formatting - uses: axel-op/googlejavaformat-action@v3 + id: format + continue-on-error: true + uses: findologic/intellij-format-action@main with: - args: "--set-exit-if-changed" + path: . + fail-on-changes: false - uses: actions/github-script@v6.3.3 - if: always() + if: steps.format.outcome != 'success' with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -104,12 +71,15 @@ jobs: repo: context.repo.repo, body: 'Comment this PR with *update_code* to update `openapi.json` and format the code. Consider to use pre-commit to format the code.' }) + core.setFailed('Format your code.') check_size: runs-on: ubuntu-latest name: Check Size steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Check Size uses: actions/github-script@v6.3.3 @@ -121,7 +91,7 @@ jobs: const additions = context.payload.pull_request.additions || 0 const deletions = context.payload.pull_request.deletions || 0 var changes = additions + deletions - console.log('additions: '+additions+'+ deletions: '+deletions+ ' = total changes: ' + changes); + console.log('additions: '+additions+' + deletions: '+deletions+ ' = total changes: ' + changes); const { IGNORED_FILES } = process.env const ignored_files = IGNORED_FILES.trim().split(',').filter(word => word.length > 0); @@ -130,8 +100,8 @@ jobs: const execSync = require('child_process').execSync; for (const file of IGNORED_FILES.trim().split(',')) { - const ignored_additions_str = execSync('git --no-pager diff --numstat main..${{ github.ref_name}} | grep ' + file + ' | cut -f 1', { encoding: 'utf-8' }) - const ignored_deletions_str = execSync('git --no-pager diff --numstat main..${{ github.ref_name}} | grep ' + file + ' | cut -f 2', { encoding: 'utf-8' }) + const ignored_additions_str = execSync('git --no-pager diff --numstat origin/main..origin/${{ github.head_ref}} | grep ' + file + ' | cut -f 1', { encoding: 'utf-8' }) + const ignored_deletions_str = execSync('git --no-pager diff --numstat origin/main..origin/${{ github.head_ref}} | grep ' + file + ' | cut -f 2', { encoding: 'utf-8' }) const ignored_additions = ignored_additions_str.split('\n').map(elem=> parseInt(elem || 0)).reduce( (accumulator, currentValue) => accumulator + currentValue, @@ -146,30 +116,53 @@ jobs: console.log('ignored lines: ' + ignored + ' , consider changes: ' + changes); } - if (changes < 200){ - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['size/small'] - }) - - - var labels = await github.rest.issues.listLabelsOnIssue({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }); + var labels = await github.rest.issues.listLabelsOnIssue({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo + }); - if (labels.data.find(label => label.name == 'size/large')){ + if (labels.data.find(label => label.name == 'size/large')){ + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: 'size/large' + }) + } + if (labels.data.find(label => label.name == 'size/small')){ github.rest.issues.removeLabel({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - name: 'size/large' + name: 'size/small' + }) + } + + var comments = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo + }); + for (const comment of comments.data) { + if (comment.body.includes('This PR exceeds the recommended size')){ + github.rest.issues.deleteComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id }) } } + + if (changes < 200){ + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['size/small'] + }) + } if (changes > 400){ github.rest.issues.addLabels({ @@ -179,22 +172,6 @@ jobs: labels: ['size/large'] }) - var comments = await github.rest.issues.listComments({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }); - for (const comment of comments.data) { - if (comment.body.includes('This PR exceeds the recommended size')){ - github.rest.issues.deleteComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: comment.id - }) - } - } - github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, @@ -202,21 +179,5 @@ jobs: body: 'This PR exceeds the recommended size of 400 lines. Please make sure you are NOT addressing multiple issues with one PR. _Note this PR might be rejected due to its size._' }) - var labels = await github.rest.issues.listLabelsOnIssue({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }); - - if (labels.data.find(label => label.name == 'size/small')){ - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: 'size/small' - }) - } - - core.setFailed('PR is too large: ' + changes + ' changes.') } diff --git a/.github/workflows/code_review.yml b/.github/workflows/code_review.yml index c6612e0c..041bdc25 100644 --- a/.github/workflows/code_review.yml +++ b/.github/workflows/code_review.yml @@ -13,12 +13,18 @@ on: branches: - main + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: env: PROJECT_KEY: "pagopa_pagopa-api-config-cache" +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: code-review: @@ -28,60 +34,85 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 - with: - maven-version: 3.8.2 - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Cache SonarCloud packages - uses: actions/cache@v1 + - name: Code Review + uses: pagopa/github-actions-template/maven-code-review@v1.4.2 with: - path: ~/.sonar-project.properties/cache - key: ${{ runner.os }}-sonar-project.properties - restore-keys: ${{ runner.os }}-sonar-project.properties - - name: Build and analyze on Pull Requests - if: ${{ github.event_name == 'pull_request' }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - -Dsonar.organization=pagopa - -Dsonar.projectKey=${{ env.PROJECT_KEY }} - -Dsonar.coverage.jacoco.xmlReportPaths=./target/site/jacoco/jacoco.xml - -Dsonar.coverage.exclusions="**/imported/**,**/exception/**,**/config/**" - -Dsonar.cpd.exclusions="**/model/**" - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.login=${{ secrets.SONAR_TOKEN }} - -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} - -Dsonar.pullrequest.branch=${{ github.head_ref }} - -Dsonar.pullrequest.base=${{ github.base_ref }} - env: - # Needed to get some information about the pull request, if any - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SonarCloud access token should be generated from https://sonarcloud.io/account/security/ - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # TODO - #to resolve dependencies - GITHUB_TOKEN_READ_PACKAGES: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + sonar_token: ${{ secrets.SONAR_TOKEN }} + project_key: ${{env.PROJECT_KEY}} + coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*" + cpd_exclusions: "**/model/**,**/entity/*" - - name: Build and analyze on Push main - if: ${{ github.event_name != 'pull_request' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GITHUB_TOKEN_READ_PACKAGES: ${{ secrets.GITHUB_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - -Dsonar.organization=pagopa - -Dsonar.projectKey=${{ env.PROJECT_KEY }} - -Dsonar.coverage.jacoco.xmlReportPaths=./target/site/jacoco/jacoco.xml - -Dsonar.coverage.exclusions="**/config/*,**/*Mock*,**/model/**,**/entity/*" - -Dsonar.cpd.exclusions="**/model/**,**/entity/*" - -Dsonar.branch.name=${{ github.head_ref }} - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.login=${{ secrets.SONAR_TOKEN }} +# smoke-test: +# name: Smoke Test +# runs-on: ubuntu-latest +# environment: +# name: dev +# steps: +# - name: Checkout +# id: checkout +# uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 +# +# - 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 }} +# +# - name: Run Service on Docker +# shell: bash +# id: run_service_docker +# run: | +# cd ./docker +# chmod +x ./run_docker.sh +# ./run_docker.sh local +# +# - name: Run Integration Tests +# shell: bash +# id: run_integration_test +# run: | +# export SUBKEY=${{ secrets.SUBKEY }} +# export CANARY=${{ inputs.canary }} +# export CUCUMBER_PUBLISH_TOKEN=${{ secrets.CUCUMBER_PUBLISH_TOKEN }} +# +# cd ./integration-test +# chmod +x ./run_integration_test.sh +# ./run_integration_test.sh local +# +# +# delete_github_deployments: +# runs-on: ubuntu-latest +# needs: smoke-test +# 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 +# }); +# }) +# ); diff --git a/.github/workflows/create_dashboard.yaml b/.github/workflows/create_dashboard.yaml index d8c01023..61fa2510 100644 --- a/.github/workflows/create_dashboard.yaml +++ b/.github/workflows/create_dashboard.yaml @@ -6,18 +6,16 @@ on: branches: - main paths: - - 'openapi/openapi.json' + - 'openapi/**' - '.github/workflows/create_dashboard.yaml' - '.opex/**' workflow_dispatch: -env: - TEMPLATE_DIR: azure-dashboard - 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: @@ -27,7 +25,7 @@ jobs: strategy: matrix: - environment: [prod, uat] + environment: [prod] environment: name: ${{ matrix.environment }} # Steps represent a sequence of tasks that will be executed as part of the job @@ -39,43 +37,48 @@ jobs: with: persist-credentials: false - - name: Read terraform version - id: read-version - shell: bash - run: | - echo "TERRAFORM_VERSION=`cat .terraform-version`" >> $GITHUB_ENV - - name: Setup Terraform - # from https://github.com/hashicorp/setup-terraform/commits/main - uses: hashicorp/setup-terraform@8feba2b913ea459066180f9cb177f58a881cf146 - with: - terraform_version: ${{ env.TERRAFORM_VERSION }} - - - name: Login - id: login - # from https://github.com/Azure/login/commits/master - uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + # from https://github.com/pagopa/opex-dashboard-azure-action/ + - uses: pagopa/opex-dashboard-azure-action@v1.1.2 with: - client-id: ${{ vars.CLIENT_ID }} - tenant-id: ${{ vars.TENANT_ID }} - subscription-id: ${{ vars.SUBSCRIPTION_ID }} + environment: ${{ matrix.environment }} + api-name: + config: .opex/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 - # this action create a folder named /azure-dashboard - - uses: pagopa/opex-dashboard-action@main + 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: - template: ${{ env.TEMPLATE_DIR }} - config: .opex/env/${{ matrix.environment }}/config.yaml + script: | + const { SHA_HEAD } = process.env - # we need to set env variables in the folder /azure-dashboard - - name: Copy Environments - run: | - cp -R .opex/env ./${TEMPLATE_DIR} - # now is possible to launch the command: terraform apply - - name: Terraform Apply - shell: bash - run: | - cd ./${TEMPLATE_DIR} - export ARM_CLIENT_ID="${{ vars.CLIENT_ID }}" - export ARM_SUBSCRIPTION_ID=$(az account show --query id --output tsv) - export ARM_TENANT_ID=$(az account show --query tenantId --output tsv) - export ARM_USE_OIDC=true - bash ./terraform.sh apply ${{ matrix.environment }} -auto-approve + 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 + }); + }) + ); diff --git a/.github/workflows/deploy_aks.yml b/.github/workflows/deploy_aks.yml deleted file mode 100644 index 2bcd36a2..00000000 --- a/.github/workflows/deploy_aks.yml +++ /dev/null @@ -1,272 +0,0 @@ -name: Deploy - -# Controls when the workflow will run -on: - pull_request: - branches: - - main - types: [ closed ] - - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - inputs: - environment: - required: true - type: choice - description: Select the Environment - options: - - dev - - uat - - prod - - all - semver: - required: true - type: choice - description: Select the new Semantic Version - options: - - major - - minor - - patch - - buildNumber - - skip - -env: - NAMESPACE: # TODO - APP_NAME: # TODO - -permissions: - packages: write - contents: write - issues: write - id-token: write - actions: read - - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - release: - name: Create a New Release - # The type of runner that the job will run on - runs-on: ubuntu-latest - outputs: - version: ${{ steps.get_version.outputs.version }} - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.ref_name}} - token: ${{ secrets.API_TOKEN_GITHUB }} - - - name: Dump GitHub context - run: echo $JSON - env: - JSON: ${{ toJSON(github) }} - - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 - with: - maven-version: 3.8.2 - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Set build-number - run: | - mvn build-helper:parse-version versions:set -DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}-${parsedVersion.nextBuildNumber}' - if: ${{ github.event.inputs.semver == 'buildNumber' }} - - - name: Set major - run: | - mvn build-helper:parse-version versions:set -DnewVersion='${parsedVersion.nextMajorVersion}.0.0' - if: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change') || github.event.inputs.semver == 'major' }} - - - name: Set minor - run: | - mvn build-helper:parse-version versions:set -DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0' - if: ${{ contains(github.event.pull_request.labels.*.name, 'enhancement') || github.event.inputs.semver == 'minor' }} - - - name: Set patch - run: | - mvn build-helper:parse-version versions:set -DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}' - if: ${{ contains(github.event.pull_request.labels.*.name, 'bug') || github.event.inputs.semver == 'patch' }} - - - id: get_version - name: Get Version - run: | - echo "$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" - echo "version=$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT - - - name: Update Version Helm - if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release')) || (github.event.inputs.semver != null && github.event.inputs.semver != 'skip') }} - run: | - for i in helm/values-*.yaml; do - [ -f "$i" ] || break - yq -i ".microservice-chart.image.tag = \"${{ steps.get_version.outputs.version }}\"" "$i" - git add "$i" - done - CHART_FILE="helm/Chart.yaml" - if [[ -f "$CHART_FILE" ]]; then - yq -i ".version = \"${{ steps.get_version.outputs.version }}\"" "$CHART_FILE" - yq -i ".appVersion = \"${{ steps.get_version.outputs.version }}\"" "$CHART_FILE" - git add "$CHART_FILE" - fi - - name: Update Openapi/Swagger Version - if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release')) || (github.event.inputs.semver != null && github.event.inputs.semver != 'skip') }} - run: | - for i in openapi/*.json; do - [ -f "$i" ] || break - cat <<< "$(jq ".info.version = \"${{ steps.get_version.outputs.version }}\"" "$i")" > "$i" - git add $i - done - for i in openapi/*.yaml; do - [ -f "$i" ] || break - yq -i ".info.version = \"${{ steps.get_version.outputs.version }}\"" "$i" - git add "$i" - done - for i in openapi/*.yml; do - [ -f "$i" ] || break - yq -i ".info.version = \"${{ steps.get_version.outputs.version }}\"" "$i" - git add "$i" - done - - - name: Push New Version - if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release')) || (github.event.inputs.semver != null && github.event.inputs.semver != 'skip') }} - run: | - echo "${{ steps.get_version.outputs.version }}" - git ls-files . | grep 'pom.xml' | xargs git add - git config --global user.email "github-bot@pagopa.it" - git config --global user.name "pagopa-github-bot" - git commit -m "Bump version [skip ci]" || exit 0 - git push origin ${{ github.ref_name}} - - - name: Create Release - if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release')) || (github.event.inputs.semver != null && github.event.inputs.semver != 'skip') }} - uses: ncipollo/release-action@v1.12.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: ${{ steps.get_version.outputs.version }} - name: Release ${{ steps.get_version.outputs.version }} - makeLatest: latest - generateReleaseNotes: true - - - build: - needs: release - runs-on: ubuntu-latest - name: Build and Push Docker Image - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.ref_name}} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4.3.0 - with: - images: ghcr.io/${{ github.repository }} - tags: | - latest - ${{ needs.release.outputs.version }} - type=ref,event=branch - type=sha - ${{ github.event.inputs.environment != null && github.event.inputs.environment || 'dev' }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - # TODO remember to add the package write permissions to the action https://github.com/users//packages/container//settings - - deploy: - needs: [release, build] - runs-on: ubuntu-latest - name: Deploy on AKS - strategy: - matrix: - environment: [ dev, uat, prod ] - include: - - environment : dev - short: d - - environment : uat - short: u - - environment : prod - short: p - steps: - - uses: actions/checkout@v3 - if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - with: - ref: ${{ github.ref_name}} - - - name: Azure Login - if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - uses: azure/login@89d153571fe9a34ed70fcf9f1d95ab8debea7a73 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - # - name: Build image on ACR - # if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - # run: | - # az configure --defaults acr=pagopa${{ matrix.short }}commonacr - # az acr build --image ${{ env.APP_NAME }}:${{ needs.release.outputs.version }} --registry pagopa${{ matrix.short }}commonacr . - - - name: Gets K8s context - id: login - if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - uses: azure/aks-set-context@v3 - with: - resource-group: pagopa-${{matrix.short}}-weu-dev-aks-rg - cluster-name: pagopa-${{matrix.short}}-weu-dev-aks - - - name: Helm Setup - if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - run: | - helm repo add microservice-chart https://pagopa.github.io/aks-microservice-chart-blueprint - helm dep build helm - - - name: Helm Deploy - if: ${{ (github.event.inputs.environment == null && matrix.environment == 'dev' ) || matrix.environment == github.event.inputs.environment || github.event.inputs.environment == 'all' }} - run: helm upgrade --namespace ${{ env.NAMESPACE }} - --install --values ./helm/values-${{ matrix.environment }}.yaml - --set microservice-chart.image.tag=${{ needs.release.outputs.version }} - --wait --timeout 5m0s - ${{ env.APP_NAME }} ./helm - - # TODO log deployment successful on App Insights - - notify: - needs: [ deploy ] - runs-on: ubuntu-latest - name: Notify - if: always() - steps: - - name: Report Status - if: always() - uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ needs.deploy.result }} - token: ${{ secrets.GITHUB_TOKEN }} - notify_when: 'failure,skipped' - notification_title: '{workflow} has {status_message}' - message_format: '{emoji} <{workflow_url}|{workflow}> {status_message} in <{repo_url}|{repo}>' - footer: 'Linked to Repo <{repo_url}|{repo}>' - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/deploy_with_github_runner.yml b/.github/workflows/deploy_with_github_runner.yml new file mode 100644 index 00000000..02a68bc2 --- /dev/null +++ b/.github/workflows/deploy_with_github_runner.yml @@ -0,0 +1,125 @@ +name: Deploy on AKS + +on: + workflow_call: + inputs: + environment: + required: true + description: The name of the environment where to deploy + type: string + target: + required: true + description: The environment target of the job + type: string + +env: + APP_NAME: cache + + +permissions: + id-token: write + contents: read + +jobs: + create_runner: + name: Create Runner + runs-on: ubuntu-22.04 + environment: + name: ${{ inputs.environment }} + if: ${{ inputs.target == inputs.environment || inputs.target == 'all' }} + outputs: + runner_name: ${{ steps.create_github_runner.outputs.runner_name }} + steps: + - name: Create GitHub Runner + id: create_github_runner + # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-create-action + uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-create-action@main + with: + client_id: ${{ secrets.CLIENT_ID }} + tenant_id: ${{ secrets.TENANT_ID }} + subscription_id: ${{ secrets.SUBSCRIPTION_ID }} + container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }} + resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} # RG of the runner + pat_token: ${{ secrets.BOT_TOKEN_GITHUB }} + + deploy: + needs: [ create_runner ] + runs-on: [ self-hosted, "${{ needs.create_runner.outputs.runner_name }}" ] + if: ${{ inputs.target == inputs.environment || inputs.target == 'all' }} + name: Deploy on AKS + environment: ${{ inputs.environment }} + steps: + - name: Deploy + uses: pagopa/github-actions-template/aks-deploy@main + with: + branch: ${{ github.ref_name }} + client_id: ${{ secrets.CLIENT_ID }} + subscription_id: ${{ secrets.SUBSCRIPTION_ID }} + tenant_id: ${{ secrets.TENANT_ID }} + env: ${{ inputs.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 --set oracledev.enabled=true --set oracleprod.enabled=true" + + cleanup_runner: + name: Cleanup Runner + needs: [ create_runner, deploy ] + if: ${{ success() || failure() && inputs.target == inputs.environment || inputs.target == 'all' }} + runs-on: ubuntu-22.04 + environment: ${{ inputs.environment }} + steps: + - name: Cleanup GitHub Runner + id: cleanup_github_runner + # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-cleanup-action + uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-cleanup-action@0ee2f58fd46d10ac7f00bce4304b98db3dbdbe9a + with: + client_id: ${{ secrets.CLIENT_ID }} + tenant_id: ${{ secrets.TENANT_ID }} + subscription_id: ${{ secrets.SUBSCRIPTION_ID }} + resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} + runner_name: ${{ needs.create_runner.outputs.runner_name }} + pat_token: ${{ secrets.BOT_TOKEN_GITHUB }} + +# update_openapi: +# needs: [ deploy ] +# runs-on: ubuntu-latest +# name: Update OpenAPI +# if: ${{ inputs.target == inputs.environment || inputs.target == 'all' }} +# environment: ${{ inputs.environment }} +# steps: +# - name: Checkout +# id: checkout +# # from https://github.com/actions/checkout/commits/main +# uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 +# with: +# persist-credentials: false +# +# - name: 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 }} +# +# +# - name: Terraform Apply +# shell: bash +# run: | +# cd ./infra +# export ARM_CLIENT_ID="${{ secrets.CLIENT_ID }}" +# export ARM_SUBSCRIPTION_ID=$(az account show --query id --output tsv) +# export ARM_TENANT_ID=$(az account show --query tenantId --output tsv) +# export ARM_USE_OIDC=true +# export ARM_ACCESS_KEY=$(az storage account keys list --resource-group io-infra-rg --account-name pagopainfraterraform${{inputs.environment}} --query '[0].value' -o tsv) +# bash ./terraform.sh init weu-${{ inputs.environment }} +# bash ./terraform.sh apply weu-${{ inputs.environment }} -auto-approve diff --git a/.github/workflows/release_deploy.yml b/.github/workflows/release_deploy.yml new file mode 100644 index 00000000..577eef34 --- /dev/null +++ b/.github/workflows/release_deploy.yml @@ -0,0 +1,148 @@ +name: Release And Deploy + +# Controls when the workflow will run +on: + pull_request: + types: [ closed ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + inputs: + environment: + required: true + type: choice + description: Select the Environment + options: + - dev + - uat + - prod + - all + beta: + required: false + type: boolean + description: deploy beta version on AKS + default: false + skip_release: + required: false + type: boolean + description: skip the release. Only deploy + default: false + + +permissions: + packages: write + contents: write + issues: write + id-token: write + actions: read + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + semver: ${{ steps.get_semver.outputs.semver }} + environment: ${{ steps.get_env.outputs.environment }} + steps: + - name: pull request rejected + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged != true + run: | + echo "❌ PR was closed without a merge" + exit 1 + + # Set Semvar + - run: echo "SEMVER=patch" >> $GITHUB_ENV + + - if: ${{ (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'breaking-change')) }} + run: echo "SEMVER=major" >> $GITHUB_ENV + + - if: ${{ inputs.environment == 'uat' }} + run: echo "SEMVER=minor" >> $GITHUB_ENV + + - if: ${{ inputs.environment == 'prod' }} + run: echo "SEMVER=skip" >> $GITHUB_ENV + + - if: ${{ github.ref_name != 'main' }} + run: echo "SEMVER=buildNumber" >> $GITHUB_ENV + + - if: ${{ inputs.skip_release }} + run: echo "SEMVER=skip" >> $GITHUB_ENV + + - id: get_semver + name: Set Output + run: echo "semver=${{env.SEMVER}}" >> $GITHUB_OUTPUT + + # Set Environment + - run: echo "ENVIRNOMENT=${{ inputs.environment}}" >> $GITHUB_ENV + + - if: ${{ inputs.environment == null }} + run: echo "ENVIRNOMENT=dev" >> $GITHUB_ENV + + - id: get_env + name: Set Output + run: echo "environment=${{env.ENVIRNOMENT}}" >> $GITHUB_OUTPUT + + + release: + name: Create a New Release + runs-on: ubuntu-latest + needs: [setup] + outputs: + version: ${{ steps.release.outputs.version }} + steps: + - name: Make Release + id: release + uses: pagopa/github-actions-template/maven-release@v1.5.4 + with: + semver: ${{ needs.setup.outputs.semver }} + github_token: ${{ secrets.BOT_TOKEN_GITHUB }} + beta: ${{ inputs.beta }} + skip_ci: false + + image: + needs: [ setup, release ] + name: Build and Push Docker Image + runs-on: ubuntu-latest + if: ${{ inputs.semver != 'skip' }} + steps: + - name: Build and Push + id: semver + uses: pagopa/github-actions-template/ghcr-build-push@v1.5.4 + with: + branch: ${{ github.ref_name}} + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ needs.release.outputs.version }} + + 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 ] + uses: ./.github/workflows/deploy_with_github_runner.yml + with: + environment: ${{ matrix.environment }} + target: ${{ needs.setup.outputs.environment }} + secrets: inherit + + notify: + needs: [ setup, release, deploy_aks ] + runs-on: ubuntu-latest + name: Notify + if: always() + steps: + - name: Report Status + if: ${{ needs.setup.outputs.environment == 'prod' || needs.setup.outputs.environment == 'all' }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ needs.deploy_aks.result }} + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: 'New Release on Production ${{ needs.release.outputs.version }} has {status_message}' + message_format: '{emoji} <{run_url}|{workflow}> {status_message} in <{repo_url}|{repo}>' + footer: 'Linked to <{workflow_url}| workflow file>' + icon_success: ':white_check_mark:' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/update_code.yml b/.github/workflows/update_code.yml index 23ce6c73..ed41d83e 100644 --- a/.github/workflows/update_code.yml +++ b/.github/workflows/update_code.yml @@ -13,13 +13,13 @@ permissions: jobs: update: name: Update Openapi and Formatting - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest if: ${{ contains(github.event.comment.body, 'update_code') }} steps: - name: Checkout uses: actions/checkout@v3 with: - token: ${{ secrets.API_TOKEN_GITHUB }} + token: ${{ secrets.BOT_TOKEN_GITHUB }} - name: Checkout Pull Request run: hub pr checkout ${{ github.event.issue.number }} @@ -33,11 +33,54 @@ jobs: - name: Update OpenApi/Swagger file run: | cd ./openapi - sh ./generate_openapi.sh + chmod +x ./generate_openapi.sh + ./generate_openapi.sh - name: Formatting - uses: axel-op/googlejavaformat-action@v3 + id: format + uses: findologic/intellij-format-action@main with: - args: "--replace" - commit-message: "Google Java format [skip ci]" + path: . + fail-on-changes: false + - name: Commit files + run: | + git config --local user.email "pagopa-github-bot@pagopa.it" + git config --local user.name "pagopa-github-bot" + git commit -a -m "Formatting" + git push + + + notify: + needs: [ update ] + runs-on: ubuntu-latest + name: Notify + if: ${{ always() && contains(needs.*.result, 'failure') }} + steps: + - name: Notify if Failure + uses: actions/github-script@v6.3.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var comments = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo + }); + for (const comment of comments.data) { + if (comment.body.includes('Update Code is failed. Please retry.')){ + github.rest.issues.deleteComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id + }) + } + } + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Update Code is failed. Please retry.' + }) + core.setFailed('Update Code is failed. Please retry.') From dd7243c71cb7a4883435a554274d0dea93b1f8a2 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 9 Aug 2023 12:14:10 +0000 Subject: [PATCH 02/11] Bump to version 0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 9d83576a..3fced8c3 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.1 +version: 0.0.2 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled - +appVersion: 0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index d11804d0..c3020e35 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-3-NOD-383-jdbc-connection-error" + "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index cf9ddff2..96680b64 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-3-NOD-383-jdbc-connection-error" + "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index 474429a9..685030af 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-3-NOD-383-jdbc-connection-error" + "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 4ace9e22..1b9a030c 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-3-NOD-383-jdbc-connection-error" + "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 8f77c5d0..973de700 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-3-NOD-383-jdbc-connection-error + 0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From 270aa30f30efaaaf8faddef9581b48010a8f32bc Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 9 Aug 2023 12:44:33 +0000 Subject: [PATCH 03/11] Bump to version 0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 3fced8c3..051afbdd 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.2 +version: 0.0.3 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index c3020e35..7b77501b 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 96680b64..293ad96e 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index 685030af..332df88b 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 1b9a030c..47643025 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 973de700..273e20e3 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-4-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From 97fa292757253ff33e0556f65d6467ca75c5bd59 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 9 Aug 2023 13:54:51 +0000 Subject: [PATCH 04/11] Bump to version 0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 051afbdd..0c1ce31e 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.3 +version: 0.0.4 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index 7b77501b..fec176d0 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 293ad96e..53f2a74a 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index 332df88b..cb75900b 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 47643025..66395e43 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 273e20e3..f8c02985 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-5-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From 67ea00a07842e08ed4ef41547fed03db426cadf6 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Thu, 10 Aug 2023 13:06:09 +0000 Subject: [PATCH 05/11] Bump to version 0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 0c1ce31e..6dd99836 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.4 +version: 0.0.5 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index fec176d0..a08a9922 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 53f2a74a..7b1da977 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index cb75900b..c1567c8a 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 66395e43..f1c177c9 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index f8c02985..1eaa9346 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-6-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From a1a8c968ebc01990fa8e6c6b473137c7d196ca72 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 23 Aug 2023 13:47:03 +0000 Subject: [PATCH 06/11] Bump to version 0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 6dd99836..667a384f 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.5 +version: 0.0.6 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index a08a9922..676c5ee8 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 7b1da977..56c54494 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index c1567c8a..42ad70ee 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index f1c177c9..601bebf0 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 1eaa9346..97d2c9d1 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-7-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From aa0bcdad0810023d9ebd6895c1511ba5444d9482 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Wed, 23 Aug 2023 15:49:55 +0200 Subject: [PATCH 07/11] [PAGOPA-1135] build phase --- .github/workflows/release_deploy.yml | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_deploy.yml b/.github/workflows/release_deploy.yml index 577eef34..f95a2d76 100644 --- a/.github/workflows/release_deploy.yml +++ b/.github/workflows/release_deploy.yml @@ -107,14 +107,44 @@ jobs: runs-on: ubuntu-latest if: ${{ inputs.semver != 'skip' }} steps: - - name: Build and Push - id: semver - uses: pagopa/github-actions-template/ghcr-build-push@v1.5.4 + # - name: Build and Push + # id: semver + # uses: pagopa/github-actions-template/ghcr-build-push@v1.5.4 + # with: + # branch: ${{ github.ref_name}} + # github_token: ${{ secrets.GITHUB_TOKEN }} + # tag: ${{ needs.release.outputs.version }} + - uses: actions/checkout@v3 with: - branch: ${{ github.ref_name}} - github_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ needs.release.outputs.version }} + ref: ${{ github.ref_name }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: ghcr.io/${{ github.repository }} + tags: | + latest + ${{ needs.release.outputs.version }} + type=ref,event=branch + type=sha + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + secrets: | + GH_TOKEN=${{ secrets.READ_PACKAGES_TOKEN }} deploy_aks: name: Deploy on AKS needs: [ setup, release, image ] From 4134992b932157d11b442189d999cd4e0e8a04f6 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 23 Aug 2023 13:52:43 +0000 Subject: [PATCH 08/11] Bump to version 0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 667a384f..e46a5302 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.6 +version: 0.0.7 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index 676c5ee8..ee6da05b 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 56c54494..8103366a 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index 42ad70ee..ccd9361c 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 601bebf0..4123bfa9 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 97d2c9d1..17dc8284 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-8-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration From 16b8b11fdbb9d5f87634992bf09a67a1186cabaa Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 24 Aug 2023 15:26:14 +0200 Subject: [PATCH 09/11] [PAGOPA-1135] dockefile --- .github/workflows/release_deploy.yml | 1 + Dockerfile | 12 +++++---- pom.xml | 7 ++++-- src/main/resources/logback-spring.xml | 36 +++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/.github/workflows/release_deploy.yml b/.github/workflows/release_deploy.yml index f95a2d76..554fba40 100644 --- a/.github/workflows/release_deploy.yml +++ b/.github/workflows/release_deploy.yml @@ -145,6 +145,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} secrets: | GH_TOKEN=${{ secrets.READ_PACKAGES_TOKEN }} + deploy_aks: name: Deploy on AKS needs: [ setup, release, image ] diff --git a/Dockerfile b/Dockerfile index 941b597c..fa19be80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ # # Build # - FROM maven:3.8.4-jdk-11-slim as buildtime -ARG github_token -ARG maven_args -ENV GITHUB_TOKEN_READ_PACKAGES=$github_token WORKDIR /build COPY . . -RUN mvn package -DskipTests=true $maven_args +RUN --mount=type=secret,id=GH_TOKEN,dst=/tmp/secret_token export GITHUB_TOKEN_READ_PACKAGES="$(cat /tmp/secret_token)" \ + && mvn clean package -Dmaven.test.skip=true FROM adoptopenjdk/openjdk11:alpine-jre as builder COPY --from=buildtime /build/target/*.jar application.jar RUN java -Djarmode=layertools -jar application.jar extract + FROM ghcr.io/pagopa/docker-base-springboot-openjdk11:v1.0.1@sha256:bbbe948e91efa0a3e66d8f308047ec255f64898e7f9250bdb63985efd3a95dbf +ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar . + COPY --chown=spring:spring --from=builder dependencies/ ./ COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./ # https://github.com/moby/moby/issues/37965#issuecomment-426853382 @@ -23,3 +23,5 @@ COPY --chown=spring:spring --from=builder spring-boot-loader/ ./ COPY --chown=spring:spring --from=builder application/ ./ EXPOSE 8080 + +ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"] diff --git a/pom.xml b/pom.xml index 17dc8284..dfcf1d3d 100644 --- a/pom.xml +++ b/pom.xml @@ -115,8 +115,11 @@ junit test - - + + co.elastic.logging + logback-ecs-encoder + 1.5.0 + diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..867f1c6e --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m %clr(%mdc){magenta}%n%wEx + + + + + + + + + + + + + + ${OTEL_SERVICE_NAME} + ${ECS_SERVICE_VERSION} + ${ENV} + + + + + + + + + From 1c299fda101fb1d0e47907eb18aab2905c472b72 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 24 Aug 2023 15:41:57 +0200 Subject: [PATCH 10/11] [PAGOPA-1135] helm values folder --- helm/{weu-dev => }/values-dev.yaml | 0 helm/{weu-prod => }/values-prod.yaml | 0 helm/{weu-uat => }/values-uat.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename helm/{weu-dev => }/values-dev.yaml (100%) rename helm/{weu-prod => }/values-prod.yaml (100%) rename helm/{weu-uat => }/values-uat.yaml (100%) diff --git a/helm/weu-dev/values-dev.yaml b/helm/values-dev.yaml similarity index 100% rename from helm/weu-dev/values-dev.yaml rename to helm/values-dev.yaml diff --git a/helm/weu-prod/values-prod.yaml b/helm/values-prod.yaml similarity index 100% rename from helm/weu-prod/values-prod.yaml rename to helm/values-prod.yaml diff --git a/helm/weu-uat/values-uat.yaml b/helm/values-uat.yaml similarity index 100% rename from helm/weu-uat/values-uat.yaml rename to helm/values-uat.yaml From 4e31f4f3445b6a281f591c0eef876b618e6f9870 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Fri, 25 Aug 2023 09:57:45 +0000 Subject: [PATCH 11/11] Bump to version 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 7 +++++++ helm/values-prod.yaml | 7 +++++++ helm/values-uat.yaml | 7 +++++++ openapi/openapi.json | 2 +- openapi/openapi_fdrv1.json | 2 +- openapi/openapi_nodev1.json | 2 +- openapi/openapi_verifierv1.json | 2 +- pom.xml | 2 +- 9 files changed, 28 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index e46a5302..229ba7c3 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pagopa-api-cache-chart description: Microservice that handles calculation for pagoPA Advanced Fees Management type: application -version: 0.0.7 +version: 0.1.0 dependencies: - name: microservice-chart version: 3.0.0 @@ -24,4 +24,4 @@ dependencies: repository: "https://pagopa.github.io/aks-microservice-chart-blueprint" alias: oracleprod condition: oracleprod.enabled -appVersion: 0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache +appVersion: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 26d512d0..0c037507 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -136,3 +136,10 @@ oracleprod: envSecrets: !!merge <<: *envSecret DB_CONFIG_PASSWORD: "oracle-db-cfg-prod-password" +microservice-chart: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache + canaryDelivery: + deployment: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 19add4f0..ac8db99f 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -116,3 +116,10 @@ oracleprod: envSecrets: !!merge <<: *envSecret DB_CONFIG_PASSWORD: "oracle-db-cfg-password" +microservice-chart: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache + canaryDelivery: + deployment: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 188c62cf..6040cacc 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -92,3 +92,10 @@ oracledev: enabled: false oracleprod: enabled: false +microservice-chart: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache + canaryDelivery: + deployment: + image: + tag: 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache diff --git a/openapi/openapi.json b/openapi/openapi.json index ee6da05b..99a80a5b 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index 8103366a..620ef6bb 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index ccd9361c..ba6d099a 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index 4123bfa9..fd7824bc 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -4,7 +4,7 @@ "title": "API-Config Cacher", "description": "Generate cache for regarding Nodo dei Pagamenti configuration", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache" + "version": "0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache" }, "servers": [ { diff --git a/pom.xml b/pom.xml index dfcf1d3d..a434b4eb 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config cache - 0.6.0-9-PAGOPA-1135-sviluppo-migrazione-api-config-cache + 0.6.0-10-PAGOPA-1135-sviluppo-migrazione-api-config-cache API-Config Cacher Generate cache for regarding Nodo dei Pagamenti configuration