Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into PAGOPA-2…
Browse files Browse the repository at this point in the history
…258-sampling

# Conflicts:
#	docker/run_docker.sh
#	helm/Chart.yaml
#	helm/values-dev.yaml
#	helm/values-prod.yaml
#	helm/values-uat.yaml
#	openapi/openapi.json
#	openapi/openapi_ec.json
#	openapi/openapi_helpdesk.json
#	openapi/openapi_io.json
#	openapi/openapi_io_patch.json
#	openapi/openapi_io_patch_lap.json
#	pom.xml
  • Loading branch information
jacopocarlini committed Oct 9, 2024
2 parents 519b579 + 50b0ab7 commit cc05c9b
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 204 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ on:
- dev
- uat
- prod
- all
version:
required: false
type: choice
description: Select the version
options:
- patch
- skip_or_promote
- new_release
- breaking_change

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:
Expand Down Expand Up @@ -58,16 +62,17 @@ jobs:
- 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' }}
# force semver if dev, !=main or skip release
- if: ${{ inputs.version == 'new_release' }}
run: echo "SEMVER=minor" >> $GITHUB_ENV

- if: ${{ inputs.environment == 'prod' }}
run: echo "SEMVER=skip" >> $GITHUB_ENV
- if: ${{ inputs.version == 'breaking_change' }}
run: echo "SEMVER=major" >> $GITHUB_ENV

- if: ${{ github.ref_name != 'main' }}
run: echo "SEMVER=buildNumber" >> $GITHUB_ENV

- if: ${{ inputs.skip_release }}
- if: ${{ inputs.version == 'skip_or_promote' }}
run: echo "SEMVER=skip" >> $GITHUB_ENV

- id: get_semver
Expand Down Expand Up @@ -145,4 +150,4 @@ jobs:
footer: 'Linked to <{workflow_url}| workflow file>'
icon_success: ':white_check_mark:'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
#
# Build
#
FROM maven:3.9.3-amazoncorretto-17@sha256:4ab7db7bd5f95e58b0ba1346ff29d6abdd9b73e5fd89c5140edead8b037386ff AS buildtime

WORKDIR /build
COPY . .
RUN mvn clean package -Dmaven.test.skip=true

RUN mvn clean package -DskipTests
#
# Package stage
#
FROM --platform=linux/amd64 amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
COPY --from=buildtime /build/target/*.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract

FROM amazoncorretto:17.0.8-alpine3.18@sha256:0c61f12abfb091be48474e836e6802ff3a93e8e038e0460af8c7f447ccbd3901 AS runtime

VOLUME /tmp
WORKDIR /app
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.0@sha256:6fa320d452fa22066441f1ef292d15eb06f944bc8bca293e1a91ea460d30a613
#ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .

COPY --from=buildtime /build/target/*.jar /app/app.jar
# The agent is enabled at runtime via JAVA_TOOL_OPTIONS.
ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.15/applicationinsights-agent-3.4.15.jar /app/applicationinsights-agent.jar
COPY --chown=spring:spring --from=builder dependencies/ ./
COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./
COPY --chown=spring:spring docker/applicationinsights.json ./applicationinsights.json

RUN chown -R nobody:nobody /app
# https://github.com/moby/moby/issues/37965#issuecomment-426853382
RUN true
COPY --chown=spring:spring --from=builder spring-boot-loader/ ./
COPY --chown=spring:spring --from=builder application/ ./

EXPOSE 8080

# USER 65534

ENTRYPOINT [ "java","-jar","/app/app.jar" ]
#ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]
19 changes: 19 additions & 0 deletions docker/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"selfDiagnostics": {
"destination": "console",
"level": "INFO"
},
"sampling": {
"requestsPerSecond": 5
},
"preview": {
"sampling": {
"overrides": [
{
"telemetryKind": "exception",
"percentage": 100
}
]
}
}
}
11 changes: 6 additions & 5 deletions docker/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ if test -f "$FILE"; then
rm .env
fi
config=$(yq -r '."microservice-chart".envConfig' ../helm/values-$ENV.yaml)
# set word splitting
IFS=$'\n'
for line in $(echo "$config" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$config" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
echo "$line" >> .env
done

keyvault=$(yq -r '."microservice-chart".keyvault.name' ../helm/values-$ENV.yaml)
secret=$(yq -r '."microservice-chart".envSecret' ../helm/values-$ENV.yaml)
for line in $(echo "$secret" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$secret" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
IFS='=' read -r -a array <<< "$line"
response=$(az keyvault secret show --vault-name $keyvault --name "${array[1]}")
response=$(echo "$response" | tr -d '\n')
value=$(echo "$response" | jq -r '.value')
value=$(echo "$response" | yq -r '.value')
value=$(echo "$value" | sed 's/\$/\$\$/g')
value=$(echo "$value" | tr -d '\n')
echo "${array[0]}=$value" >> .env
Expand All @@ -51,7 +52,7 @@ docker compose -p "${stack_name}" up -d --remove-orphans --force-recreate --buil
printf 'Waiting for the service'
attempt_counter=0
max_attempts=50
until $(curl --output /dev/null --silent --head --fail http://localhost:8080/actuator/info); do
until $(curl --output /dev/null --silent --head --fail http://localhost:8080/info); do
if [ ${attempt_counter} -eq ${max_attempts} ];then
echo "Max attempts reached"
exit 1
Expand All @@ -61,4 +62,4 @@ until $(curl --output /dev/null --silent --head --fail http://localhost:8080/act
attempt_counter=$((attempt_counter+1))
sleep 5
done
echo 'Service Started'
echo 'Service Started'
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-biz-events-service
description: Microservice for exposing REST APIs about payment receipts.
type: application
version: 0.80.0
appVersion: 0.1.57
version: 0.86.0
appVersion: 0.1.60
dependencies:
- name: microservice-chart
version: 2.4.0
Expand Down
7 changes: 4 additions & 3 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-biz-events-service
tag: "0.1.57"
tag: "0.1.60"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -70,6 +70,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'dev'
WEBSITE_SITE_NAME: 'pagopabizeventsservice' # required to show cloud role name in application insights
COSMOS_DB_URI: 'https://pagopa-d-weu-bizevents-ds-cosmos-account.documents.azure.com:443/'
COSMOS_DB_NAME: 'db'
Expand All @@ -88,8 +89,8 @@ microservice-chart:
CONNECTION_TIMEOUT: "10000"
REDIS_PORT: "6380"
REDIS_TTL: "5" # 5 minutes
OTEL_SERVICE_NAME: "pagopabizeventsservice"
OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=dev"
OTEL_SERVICE_NAME: "pagopa-bizevents-service"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
Expand Down
7 changes: 4 additions & 3 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-biz-events-service
tag: "0.1.57"
tag: "0.1.60"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -70,6 +70,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'prod'
WEBSITE_SITE_NAME: 'pagopabizeventsservice' # required to show cloud role name in application insights
COSMOS_DB_URI: 'https://pagopa-p-weu-bizevents-ds-cosmos-account.documents.azure.com:443/'
COSMOS_DB_NAME: 'db'
Expand All @@ -88,8 +89,8 @@ microservice-chart:
CONNECTION_TIMEOUT: "10000"
REDIS_PORT: "6380"
REDIS_TTL: "20" # 20 minutes
OTEL_SERVICE_NAME: "pagopabizeventsservice"
OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=prod"
OTEL_SERVICE_NAME: "pagopa-bizevents-service"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=prod"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
Expand Down
7 changes: 4 additions & 3 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-biz-events-service
tag: "0.1.57"
tag: "0.1.60"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -70,6 +70,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'uat'
WEBSITE_SITE_NAME: 'pagopabizeventsservice' # required to show cloud role name in application insights
COSMOS_DB_URI: 'https://pagopa-u-weu-bizevents-ds-cosmos-account.documents.azure.com:443/'
COSMOS_DB_NAME: 'db'
Expand All @@ -88,8 +89,8 @@ microservice-chart:
CONNECTION_TIMEOUT: "10000"
REDIS_PORT: "6380"
REDIS_TTL: "20" # 20 minutes
OTEL_SERVICE_NAME: "pagopabizeventsservice"
OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=uat"
OTEL_SERVICE_NAME: "pagopa-bizevents-service"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=uat"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/config/.env.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BIZ_EVENTS_SERVICE_HOST=https://api.dev.platform.pagopa.it/bizevents/service/v1/
BIZ_EVENTS_HELPDESK_HOST=https://api.dev.platform.pagopa.it/bizevents/helpdesk/v1/
BIZ_EVENTS_TRXSRV_HOST=https://api.dev.platform.pagopa.it/bizevents/tx-service/v1/
BIZ_EVENTS_LAPSRV_HOST=https://api.dev.platform.pagopa.it/bizevents/notices-service/v1/
COSMOS_DB_URI=https://pagopa-d-weu-bizevents-ds-cosmos-account.documents.azure.com:443/
COSMOS_DB_NAME=db
COSMOS_DB_CONTAINER_NAME=biz-events
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/config/.env.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BIZ_EVENTS_SERVICE_HOST=<localhost>
BIZ_EVENTS_HELPDESK_HOST=<localhost>
BIZ_EVENTS_TRXSRV_HOST=<localhost>
BIZ_EVENTS_LAPSRV_HOST=<localhost>
COSMOS_DB_URI=https://pagopa-d-weu-bizevents-ds-cosmos-account.documents.azure.com:443/
COSMOS_DB_NAME=db
COSMOS_DB_CONTAINER_NAME=biz-events
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/config/.env.uat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BIZ_EVENTS_SERVICE_HOST=https://api.uat.platform.pagopa.it/bizevents/service/v1/
BIZ_EVENTS_HELPDESK_HOST=https://api.uat.platform.pagopa.it/bizevents/helpdesk/v1/
BIZ_EVENTS_TRXSRV_HOST=https://api.uat.platform.pagopa.it/bizevents/tx-service/v1/
BIZ_EVENTS_LAPSRV_HOST=https://api.uat.platform.pagopa.it/bizevents/notices-service/v1/
COSMOS_DB_URI=https://pagopa-u-weu-bizevents-ds-cosmos-account.documents.azure.com:443/
COSMOS_DB_NAME=db
COSMOS_DB_CONTAINER_NAME=biz-events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { get, post } = require("./common");

const bizevents_service_host = process.env.BIZ_EVENTS_SERVICE_HOST;
const bizevents_helpdesk_host = process.env.BIZ_EVENTS_HELPDESK_HOST;
const bizevents_trxsrv_host = process.env.BIZ_EVENTS_TRXSRV_HOST;
const bizevents_trxsrv_host = process.env.BIZ_EVENTS_LAPSRV_HOST;


// is the same 4all
Expand All @@ -25,7 +25,7 @@ function getBizEventByOrgFiscalCodeAndIuv(organizationfiscalcode, iuv) {
return get(bizevents_helpdesk_host + `events/organizations/${organizationfiscalcode}/iuvs/${iuv}`, {})
}

// >>> BIZ_EVENTS_TRXSRV_HOST
// >>> BIZ_EVENTS_LAPSRV_HOST
function getTransactionListForUserWithFiscalCode(fiscalcode) {
return get(bizevents_trxsrv_host + `paids?size=10`, {
"x-fiscal-code": fiscalcode
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_ec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_helpdesk.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_io.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_io_patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_io_patch_lap.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Biz-Events Service",
"description": "Microservice for exposing REST APIs about payment receipts.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.1.57"
"version": "0.1.60"
},
"servers": [
{
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>bizeventsservice</artifactId>
<version>0.1.57</version>
<version>0.1.60</version>
<name>Biz-Events Service</name>
<description>Microservice for exposing REST APIs about payment receipts.</description>

Expand All @@ -20,7 +20,7 @@
<springdoc-version>1.6.12</springdoc-version>
<modelmapper-version>3.1.0</modelmapper-version>
<cosmos-data-version>3.29.1</cosmos-data-version>
<elasticsearch.version>1.5.0</elasticsearch.version>
<elasticsearch.version>1.6.0</elasticsearch.version>
<spring-cloud.version>2021.0.9</spring-cloud.version>
</properties>

Expand Down
Loading

0 comments on commit cc05c9b

Please sign in to comment.