Skip to content

Commit

Permalink
Merge pull request #1 from pagopa/VAS-834-feat-add-notice-generation
Browse files Browse the repository at this point in the history
[VAS-834][VAS-973] feat: add notice generation
  • Loading branch information
jacopocarlini authored May 10, 2024
2 parents e20eb36 + f067a74 commit 3e58e06
Show file tree
Hide file tree
Showing 101 changed files with 3,853 additions and 815 deletions.
149 changes: 75 additions & 74 deletions .github/workflows/code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,80 +40,81 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
project_key: ${{env.PROJECT_KEY}}
java_version: 17
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*"
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*,**/exception/*"
cpd_exclusions: "**/models/**,**/entity/*"
java_version: 17

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
});
})
);
# 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
# });
# })
# );
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ hs_err_pid*
# Helm
/helm/charts/*
**/.terraform/

/temp
2 changes: 1 addition & 1 deletion .identity/env/dev/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformdev"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-print-payment-notice-generator.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Dev"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-print-payment-notice-generator"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .identity/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-print-payment-notice-generator.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-print-payment-notice-generator"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .identity/env/uat/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformuat"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-print-payment-notice-generator.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Uat"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-print-payment-notice-generator"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .opex/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "opex.<your-repo-name>.terraform.tfstate" #TODO
key = "opex.pagopa-print-payment-notice-generator.terraform.tfstate"
4 changes: 2 additions & 2 deletions .opex/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
oa3_spec: ./openapi/openapi.json # If start with http the file would be downloaded from the internet
name: opex_<your-repo-name> # TODO
location: West Europe
name: opex_pagopa-print-payment-notice-generator
location: Italy North
timespan: 5m # Default, a number or a timespan https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/timespan
data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-vnet-rg/providers/Microsoft.Network/applicationGateways/pagopa-p-app-gw
#data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim
Expand Down
2 changes: 1 addition & 1 deletion .opex/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-print-payment-notice-generator"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#
# Build
#
FROM maven:3.8.4-jdk-11-slim as buildtime
FROM maven:3.9.6-amazoncorretto-17-al2023@sha256:4c8bd9ec72b372f587f7b9d92564a307e4f5180b7ec08455fb346617bae1757e as buildtime
WORKDIR /build
COPY . .
RUN mvn clean package
RUN mvn clean package -Dmaven.test.skip=true


FROM adoptopenjdk/openjdk11:alpine-jre as builder
FROM amazoncorretto:17.0.10-alpine3.19@sha256:180e9c91bdbaad3599fedd2f492bf0d0335a9382835aa64669b2c2a8de7c9a22 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 .
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.3@sha256:a4e970ef05ecf2081424a64707e7c20856bbc40ddb3e99b32a24cd74591817c4

COPY --chown=spring:spring --from=builder dependencies/ ./
COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./
Expand All @@ -24,4 +23,4 @@ COPY --chown=spring:spring --from=builder application/ ./

EXPOSE 8080

ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]
ENTRYPOINT ["java","--enable-preview","org.springframework.boot.loader.launch.JarLauncher"]
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: pagopa-afm-calculator
description: Microservice that handles calculation for pagoPA Advanced Fees Management
name: pagopa-print-payment-notice-generator
description: Microservice that handles services for notice print generation
type: application
version: 0.0.0
appVersion: 0.0.0
Expand Down
26 changes: 16 additions & 10 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
microservice-chart:
namespace: "your-namespace" # TODO: set your AKS namespace
namespace: "printit"
nameOverride: ""
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/yourname # TODO
repository: ghcr.io/pagopa/pagopa-print-payment-notice-generator
tag: "0.0.0"
pullPolicy: Always
livenessProbe:
Expand All @@ -29,8 +29,8 @@ microservice-chart:
- 8080
ingress:
create: true
host: "your.host" # TODO: set the host
path: /your-path-here/(.*) # TODO: set your path
host: "printit.itn.internal.dev.platform.pagopa.it"
path: /pagopa-print-payment-notice-generator/(.*)
servicePort: 8080
serviceAccount:
create: false
Expand Down Expand Up @@ -62,26 +62,32 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
# TODO: set your name
WEBSITE_SITE_NAME: 'yourProjectName' # required to show cloud role name in application insights
WEBSITE_SITE_NAME: 'print-payment-notice-generator' # required to show cloud role name in application insights
ENV: 'azure-dev'
APP_LOGGING_LEVEL: 'DEBUG'
DEFAULT_LOGGING_LEVEL: 'INFO'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'

OTEL_SERVICE_NAME: # TODO
OTEL_SERVICE_NAME: 'print-payment-notice-generator-otl'
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
KAFKA_BROKER: "pagopa-d-itn-core-evh-meucci.servicebus.windows.net:9093"
KAFKA_NOTICE_GENERATION_TOPIC: pagopa-printit-evh
envSecret:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'ai-d-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
MONGODB_CONNECTION_URI: 'notices_mongo_connection_string'
TEMPLATE_STORAGE_CONN_STRING: 'templates_storage_account_connection_string'
INSTITUTION_STORAGE_CONN_STRING: 'institutions_storage_account_connection_string'
NOTICE_STORAGE_CONN_STRING: 'notices_storage_account_connection_string'
KAFKA_SASL_JAAS_CONFIG: 'ehub_notice_connection_string'
PDF_ENGINE_SUBKEY: 'pdf_engine_node_subkey'
keyvault:
name: "pagopa-d-name-kv" #TODO
name: "pagopa-d-itn-printit-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
nodeSelector: { }
tolerations: [ ]
Expand All @@ -108,7 +114,7 @@ microservice-chart:
deployment:
create: true
image:
repository: ghcr.io/pagopa/yourname # TODO
repository: ghcr.io/pagopa/pagopa-print-payment-notice-generator
tag: "0.0.0"
pullPolicy: Always
envConfig: { }
Expand Down
Loading

0 comments on commit 3e58e06

Please sign in to comment.