From cb5f390946c3d118794f88b09587cf60cf36ca44 Mon Sep 17 00:00:00 2001 From: Michael Disaro Date: Mon, 13 May 2024 17:04:03 +0200 Subject: [PATCH 1/2] chore: updated to java 17 --- .devops/code-review-pipelines.yml | 2 +- .devops/deploy-pipelines.yml.old | 207 ------------------------------ Dockerfile | 15 ++- pom.xml | 6 +- 4 files changed, 15 insertions(+), 215 deletions(-) delete mode 100644 .devops/deploy-pipelines.yml.old diff --git a/.devops/code-review-pipelines.yml b/.devops/code-review-pipelines.yml index dceef822..b2517873 100644 --- a/.devops/code-review-pipelines.yml +++ b/.devops/code-review-pipelines.yml @@ -39,7 +39,7 @@ steps: mavenPomFile: 'pom.xml' mavenOptions: '-Xmx3072m $(MAVEN_OPTS)' javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' + jdkVersionOption: '1.17' jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' diff --git a/.devops/deploy-pipelines.yml.old b/.devops/deploy-pipelines.yml.old deleted file mode 100644 index 83080847..00000000 --- a/.devops/deploy-pipelines.yml.old +++ /dev/null @@ -1,207 +0,0 @@ -# Azure DevOps pipeline to release a new version and deploy to production. - -variables: - NAMESPACE: 'payments' - MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository - MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - BUILD_NUMBER: $(Build.BuildNumber) - DOCKER_IMAGE: 'io-pagopa-payment-updater-ms' - -parameters: - - name: 'RELEASE_SEMVER' - displayName: 'When packing a release, define the version bump to apply' - type: string - values: - - major - - minor - - patch - default: minor - - name: 'FORCE_REPLACE_DOCKER_IMAGE' - displayName: 'Force the existing docker image to be replaced' - type: boolean - default: True - values: - - False - - True - - name: 'ENVIRONMENT_WEU_BETA' - displayName: 'Deploy to weu-beta' - type: boolean - default: True - values: - - False - - True - - name: 'ENVIRONMENT_WEU_PROD_01' - displayName: 'Deploy to weu-prod-01' - type: boolean - default: True - values: - - False - - True - - name: 'ENVIRONMENT_WEU_PROD_02' - displayName: 'Deploy to weu-prod-02' - type: boolean - default: False - values: - - False - - True - -# Only manual activations are intended -trigger: none -pr: none - -# resources: -# repositories: -# - repository: pagopaCommons -# type: github -# name: pagopa/azure-pipeline-templates -# ref: refs/tags/v19 -# endpoint: 'io-azure-devops-github-ro' - -pool: - vmImage: 'ubuntu-latest' - -stages: - # Build - - stage: Build - #dependsOn: - # - Release - jobs: - - job: 'Build' - steps: - # - task: Bash@3 - # displayName: Check Version and Branch - # inputs: - # targetType: 'inline' - # script: | - # version=$(cat pom.xml | grep '^.*' | sed -n 2p | awk -F'[><]' '{print $3}') - # branch="$(Build.SourceBranch)" - # if [[ "$branch" != "refs/heads/master" && ! "$branch" =~ "refs/tags/.*" && "${{ parameters.environment }}" == "prod" ]]; then - # echo "Deploy branch $branch is not allowed." - # exit 1 - # fi - # if [[ "$version" == *SNAPSHOT && "${{ parameters.environment }}" == "prod" ]]; then - # echo "Version $version is not allowed." - # exit 1 - # fi - # failOnStderr: true - - - task: Bash@3 - displayName: Get POM version - name: getpomversion - inputs: - targetType: 'inline' - script: | - version=$(cat pom.xml | grep '^.*' | sed -n 2p | awk -F'[><]' '{print $3}') - echo "##vso[task.setvariable variable=outputpomversion;isOutput=true]$version" - failOnStderr: true - - - task: Docker@2 - displayName: 'docker login' - inputs: - containerRegistry: 'io-p-payments-acr-docker-registry-prod' - command: 'login' - - task: Bash@3 - displayName: 'docker build and push (force)' - condition: and(succeeded(), eq(${{ parameters.FORCE_REPLACE_DOCKER_IMAGE }}, True)) - inputs: - targetType: 'inline' - script: | - echo "the parameter FORCE_REPLACE_DOCKER_IMAGE is set to true, start build and push" - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(Build.BuildId) . - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(getpomversion.outputpomversion) . - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):latest . - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(Build.BuildId) - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(getpomversion.outputpomversion) - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):latest - - task: Bash@3 - displayName: 'docker build and push' - condition: and(succeeded(), eq(${{ parameters.FORCE_REPLACE_DOCKER_IMAGE }}, False)) - inputs: - targetType: 'inline' - script: | - # docker will return 0 on success or 1 on failure. - docker manifest inspect iopcommonacr.azurecr.io/$(DOCKER_IMAGE):latest > /dev/null - - if [ $? -eq 0 ]; then - echo "docker image already exists in the registry, skip build and push" - else - echo "docker image does not exist in the registry, start build and push" - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(Build.BuildId) . - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(getpomversion.outputpomversion) . - docker build -t iopcommonacr.azurecr.io/$(DOCKER_IMAGE):latest . - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(Build.BuildId) - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):$(getpomversion.outputpomversion) - docker push iopcommonacr.azurecr.io/$(DOCKER_IMAGE):latest - fi - - - stage: 'Serving_helm' - displayName: 'Serving_Helm' - dependsOn: Build - jobs: - - job: Serving_helm - displayName: Serving_helm - steps: - - task: PublishPipelineArtifact@1 - displayName: 'Publish Artifact manifests' - condition: succeeded() - inputs: - targetPath: '$(Build.Repository.LocalPath)/helm' - artifact: 'helm' - publishLocation: 'pipeline' - - - stage: 'Deploy' - dependsOn: 'Serving_helm' - jobs: - - deployment: 'Deploy' - pool: - name: io-prod-linux - environment: PROD - strategy: - runOnce: - deploy: - steps: - - download: none - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: 'helm' - targetPath: '$(Pipeline.Workspace)/helm' - - task: Bash@3 - displayName: 'prepare helm' - inputs: - targetType: 'inline' - script: | - helm repo add microservice-chart https://pagopa.github.io/aks-microservice-chart-blueprint - helm dep build $(Pipeline.Workspace)/helm - - task: HelmDeploy@0 - displayName: Helm upgrade - condition: and(succeeded(), eq(${{ parameters.ENVIRONMENT_WEU_BETA }}, True)) - inputs: - kubernetesServiceEndpoint: io-payments-aks-weu-beta - namespace: $(NAMESPACE) - command: upgrade - chartType: filepath - chartPath: $(Pipeline.Workspace)/helm - chartName: $(DOCKER_IMAGE) - releaseName: $(DOCKER_IMAGE) - valueFile: '$(Pipeline.Workspace)/helm/values-beta.yaml' - overrideValues: microservice-chart.image.tag=$(Build.BuildId) - install: true - waitForExecution: true - arguments: '--timeout 5m0s' - - task: HelmDeploy@0 - displayName: Helm upgrade - condition: and(succeeded(), eq(${{ parameters.ENVIRONMENT_WEU_PROD_01 }}, True)) - inputs: - kubernetesServiceEndpoint: io-payments-aks-weu-prod01 - namespace: $(NAMESPACE) - command: upgrade - chartType: filepath - chartPath: $(Pipeline.Workspace)/helm - chartName: $(DOCKER_IMAGE) - releaseName: $(DOCKER_IMAGE) - valueFile: '$(Pipeline.Workspace)/helm/values-prod01.yaml' - overrideValues: microservice-chart.image.tag=$(Build.BuildId) - install: true - waitForExecution: true - arguments: '--timeout 5m0s' diff --git a/Dockerfile b/Dockerfile index 1610c6c4..f0e28a7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,27 @@ # # Build # -FROM maven:3.8.4-jdk-11-slim as buildtime +FROM eclipse-temurin:17.0.10_7-jdk-alpine as buildtime + +RUN apk --no-cache add curl + +RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ + && curl -fsSL https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz \ + | tar -xzC /usr/share/maven --strip-components=1 \ + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn WORKDIR /build COPY . . -RUN mvn clean package +RUN mvn clean package -DskipTests -FROM adoptopenjdk/openjdk11:alpine-jre as builder +FROM eclipse-temurin:17.0.10_7-jdk-alpine as builder COPY --from=buildtime /build/target/*.jar application.jar RUN java -Djarmode=layertools -jar application.jar extract -FROM adoptopenjdk/openjdk11:alpine-jre +FROM eclipse-temurin:17.0.10_7-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring diff --git a/pom.xml b/pom.xml index 8882e740..f99be7e5 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 2.6.6 - 11 + 17 UTF-8 1.5.8 @@ -108,7 +108,7 @@ org.projectlombok lombok true - 1.18.20 + 1.18.22 org.thymeleaf @@ -309,7 +309,7 @@ org.jacoco jacoco-maven-plugin - 0.8.6 + 0.8.8 default-prepare-agent From b135ffd3a28e578c1e5697b7e47b46776217d7f6 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 13 May 2024 15:25:11 +0000 Subject: [PATCH 2/2] Bump version [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-beta.yaml | 2 +- helm/values-prod01.yaml | 2 +- openapi/openapi.yaml | 2 +- openapi/openapi_V1.yaml | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 371caf46..ac789490 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: io-pagopa-payment-updater-ms description: io-pagopa-payment-updater-ms type: application -version: 2.6.6 -appVersion: 2.6.6 +version: 2.6.7 +appVersion: 2.6.7 dependencies: - name: microservice-chart version: 5.2.0 diff --git a/helm/values-beta.yaml b/helm/values-beta.yaml index 53df072d..f1ce2eac 100644 --- a/helm/values-beta.yaml +++ b/helm/values-beta.yaml @@ -2,7 +2,7 @@ microservice-chart: namespace: "payments" image: repository: "iopcommonacr.azurecr.io/io-pagopa-payment-updater-ms" - tag: "2.6.6" + tag: "2.6.7" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod01.yaml b/helm/values-prod01.yaml index a7635e64..90ab72d3 100644 --- a/helm/values-prod01.yaml +++ b/helm/values-prod01.yaml @@ -2,7 +2,7 @@ microservice-chart: namespace: "payments" image: repository: "iopcommonacr.azurecr.io/io-pagopa-payment-updater-ms" - tag: "2.6.6" + tag: "2.6.7" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 86460461..8398340e 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -2,7 +2,7 @@ swagger: '2.0' info: title: Microservice JAVA API description: Microservice JAVA API - version: '2.6.6' + version: '2.6.7' host: localhost basePath: /api/v1 schemes: diff --git a/openapi/openapi_V1.yaml b/openapi/openapi_V1.yaml index 3b6e7fee..dbd72dba 100644 --- a/openapi/openapi_V1.yaml +++ b/openapi/openapi_V1.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Microservice JAVA API description: Microservice JAVA API - version: 2.6.6 + version: 2.6.7 servers: - url: http://localhost:9090/api/v1/payment description: DEV diff --git a/pom.xml b/pom.xml index f99be7e5..18cbe2ab 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ it.gov.pagopa paymentupdater - 2.6.6 + 2.6.7 17