Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[VAS-829] feat: add get folder status api #1

Merged
merged 16 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 76 additions & 74 deletions .github/workflows/code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
workflow_dispatch:

env:
PROJECT_KEY: # TODO
PROJECT_KEY: pagopa_pagopa-print-payment-notice-service

permissions:
id-token: write
Expand All @@ -35,84 +35,86 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Code Review
uses: pagopa/github-actions-template/maven-code-review@v1.4.2
uses: pagopa/github-actions-template/maven-code-review@v1.10.6
with:
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/*"
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
# });
# })
# );
6 changes: 3 additions & 3 deletions .identity/99_variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
locals {
github = {
org = "pagopa"
repository = "TODO" #TODO
repository = "pagopa-print-payment-notice-service"
}

prefix = "pagopa"
domain = "TODO" #TODO
location_short = "weu"
domain = "printit"
location_short = "itn"
product = "${var.prefix}-${var.env_short}"

app_name = "github-${local.github.org}-${local.github.repository}-${var.prefix}-${local.domain}-${var.env}-aks"
Expand Down
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-service.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-service"
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-service.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-service"
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-service.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-service"
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-service.terraform.tfstate"
2 changes: 1 addition & 1 deletion .opex/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
oa3_spec: ./openapi/openapi.json # If start with http the file would be downloaded from the internet
name: opex_<your-repo-name> # TODO
name: opex_pagopa-print-payment-notice-service
location: West Europe
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
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-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +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
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.3@sha256:a4e970ef05ecf2081424a64707e7c20856bbc40ddb3e99b32a24cd74591817c4
ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .
alessio-cialini marked this conversation as resolved.
Show resolved Hide resolved

COPY --chown=spring:spring --from=builder dependencies/ ./
Expand All @@ -24,4 +24,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","-javaagent:opentelemetry-javaagent.jar","--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-service
description: Microservice that handles services for notice print
type: application
version: 0.0.0
appVersion: 0.0.0
alessio-cialini marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
18 changes: 9 additions & 9 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-service
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: "itndev.printit.internal.dev.platform.pagopa.it"
path: /pagopa-print-payment-notice-service/(.*)
servicePort: 8080
serviceAccount:
create: false
Expand Down Expand Up @@ -62,14 +62,13 @@ 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-service' # 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-service-otl'
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
Expand All @@ -80,8 +79,9 @@ microservice-chart:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'ai-d-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
MONGODB_CONNECTION_URI: 'notices_mongo_connection_string'
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 +108,7 @@ microservice-chart:
deployment:
create: true
image:
repository: ghcr.io/pagopa/yourname # TODO
repository: ghcr.io/pagopa/pagopa-print-payment-notice-service
tag: "0.0.0"
pullPolicy: Always
envConfig: { }
Expand Down
Loading
Loading