Skip to content

Commit

Permalink
Merge pull request #3 from pagopa/fix_action
Browse files Browse the repository at this point in the history
Fix action
  • Loading branch information
lorenzo-catalano authored Jan 26, 2024
2 parents c005cb9 + 776f4b9 commit e23e05c
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 1,114 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/04h_deploy_with_github_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,32 @@ jobs:
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 }}
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.CD_CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM maven:3.8.4-jdk-11-slim as buildtime
WORKDIR /build
COPY . .
RUN mvn clean package
RUN mvn clean package -DskipTests


FROM adoptopenjdk/openjdk11:alpine-jre as builder
Expand Down
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-stand-in-tech-support
description: Microservice that handles Stand-In tech support api
type: application
version: 0.48.0
appVersion: 0.0.2
version: 0.53.0
appVersion: 0.0.2-5-fix_action
dependencies:
- name: microservice-chart
version: 3.0.0
Expand Down
6 changes: 4 additions & 2 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-stand-in-technical-support
tag: "0.0.2"
tag: "0.0.2-5-fix_action"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -28,7 +28,9 @@ microservice-chart:
ports:
- 8080
ingress:
create: false
create: true
host: "weudev.nodo.internal.dev.platform.pagopa.it"
path: /pagopa-stand-in-technical-support(/|$)(.*)
serviceAccount:
create: false
annotations: {}
Expand Down
6 changes: 4 additions & 2 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-stand-in-technical-support
tag: "0.0.2"
tag: "0.0.2-5-fix_action"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -28,7 +28,9 @@ microservice-chart:
ports:
- 8080
ingress:
create: false
create: true
host: "weudev.nodo.internal.platform.pagopa.it"
path: /pagopa-stand-in-technical-support(/|$)(.*)
serviceAccount:
create: false
annotations: {}
Expand Down
6 changes: 4 additions & 2 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-stand-in-technical-support
tag: "0.0.2"
tag: "0.0.2-5-fix_action"
pullPolicy: Always
livenessProbe:
httpGet:
Expand All @@ -28,7 +28,9 @@ microservice-chart:
ports:
- 8080
ingress:
create: false
create: true
host: "weudev.nodo.internal.uat.platform.pagopa.it"
path: /pagopa-stand-in-technical-support(/|$)(.*)
serviceAccount:
create: false
annotations: {}
Expand Down
13 changes: 7 additions & 6 deletions infra/04_apim_api.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
locals {
project_name = "stand-in-technical-support"
repo_name = "pagopa-stand-in-technical-support"

display_name = "Stand-in Technical Support"
Expand All @@ -9,32 +10,32 @@ locals {
hostname = var.hostname
}

resource "azurerm_api_management_group" "api_group" {
resource "azurerm_api_management_group" "api_group_standin" {
name = local.apim.product_id
resource_group_name = local.apim.rg
api_management_name = local.apim.name
display_name = local.display_name
description = local.description
}

resource "azurerm_api_management_api_version_set" "api_version_set" {
name = format("%s-${local.repo_name}", var.env_short)
resource "azurerm_api_management_api_version_set" "api_version_set_standin" {
name = "${var.prefix}-${var.env_short}-${var.location_short}-${local.project_name}"
resource_group_name = local.apim.rg
api_management_name = local.apim.name
display_name = local.display_name
versioning_scheme = "Segment"
}

module "api_v1" {
module "standin_api_v1" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.7.0"

name = format("%s-${local.repo_name}", var.env_short)
name = format("%s-technical-support-api", var.env_short)
api_management_name = local.apim.name
resource_group_name = local.apim.rg
product_ids = [local.apim.product_id]
subscription_required = true

version_set_id = azurerm_api_management_api_version_set.api_version_set.id
version_set_id = azurerm_api_management_api_version_set.api_version_set_standin.id
api_version = "v1"

description = local.description
Expand Down
3 changes: 2 additions & 1 deletion infra/99_locals.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
locals {
product = "${var.prefix}-${var.env_short}"
project = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}"

apim = {
name = "${local.product}-apim"
rg = "${local.product}-api-rg"
product_id = "pagopa-stand-in-technical-support"
product_id = "technical_support_api"
}
}

26 changes: 24 additions & 2 deletions infra/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "prefix" {
type = string
validation {
condition = (
length(var.prefix) <= 6
length(var.prefix) <= 6
)
error_message = "Max length is 6 chars."
}
Expand All @@ -18,12 +18,23 @@ variable "env_short" {
type = string
validation {
condition = (
length(var.env_short) == 1
length(var.env_short) == 1
)
error_message = "Length must be 1 chars."
}
}

variable "location_short" {
type = string
validation {
condition = (
length(var.location_short) == 3
)
error_message = "Length must be 3 chars."
}
description = "One of wue, neu"
}

variable "tags" {
type = map(any)
default = {
Expand All @@ -48,3 +59,14 @@ variable "hostname" {
default = null
description = "Hostname for the API"
}

variable "domain" {
type = string
validation {
condition = (
length(var.domain) <= 12
)
error_message = "Max length is 12 chars."
}
default = "nodo"
}
2 changes: 1 addition & 1 deletion infra/env/weu-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 = "pagopa-node-technical-support-worker.infra.tfstate"
key = "pagopa-stand-in-technical-support.infra.tfstate"
2 changes: 2 additions & 0 deletions infra/env/weu-dev/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
prefix = "pagopa"
env = "dev"
env_short = "d"
location_short = "weu"


tags = {
CreatedBy = "Terraform"
Expand Down
2 changes: 1 addition & 1 deletion infra/env/weu-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 = "pagopa-node-technical-support-worker.infra.tfstate"
key = "pagopa-stand-in-technical-support.infra.tfstate"
1 change: 1 addition & 0 deletions infra/env/weu-prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
prefix = "pagopa"
env = "prod"
env_short = "p"
location_short = "weu"

tags = {
CreatedBy = "Terraform"
Expand Down
2 changes: 1 addition & 1 deletion infra/env/weu-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 = "pagopa-node-technical-support-worker.infra.tfstate"
key = "pagopa-stand-in-technical-support.infra.tfstate"
1 change: 1 addition & 0 deletions infra/env/weu-uat/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
prefix = "pagopa"
env = "uat"
env_short = "u"
location_short = "weu"

tags = {
CreatedBy = "Terraform"
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": "pagopa-stand-in-technical-support",
"description": "Stand in Tech Support API",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.0.2"
"version": "0.0.2-5-fix_action"
},
"servers": [
{
Expand Down
57 changes: 7 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>pagopa-stand-in-technical-support</artifactId>
<version>0.0.2</version>
<version>0.0.2-5-fix_action</version>
<description>Stand in Tech Support API</description>

<properties>
Expand Down Expand Up @@ -110,6 +110,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
<version>1.5.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -136,55 +142,6 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.0.1</version>
<executions>
<execution>
<id>cache-openapi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi_config.json</inputSpec>
<generatorName>java</generatorName>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<packageName>it.gov.pagopa.standintechsupport.config</packageName>
<modelPackage>it.gov.pagopa.standintechsupport.config.model</modelPackage>
<dateLibrary>java8</dateLibrary>
<openApiNullable>false</openApiNullable>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<useJakartaEe>true</useJakartaEe>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>

<!-- <plugin>-->
<!-- <groupId>com.sun.xml.ws</groupId>-->
<!-- <artifactId>jaxws-maven-plugin</artifactId>-->
<!-- <version>3.0.0</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>wsimport</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <packageName>it.gov.pagopa.standinmanager.wsdl</packageName>-->
<!-- <wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>-->
<!-- <sourceDestDir>${sourcesDir}</sourceDestDir>-->
<!-- <destDir>${classesDir}</destDir>-->
<!-- <extension>true</extension>-->
<!-- </configuration>-->
<!-- </plugin>-->

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<springProperty name="ECS_SERVICE_VERSION" source="info.application.version"/>
<appender name="ECS_JSON_CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="co.elastic.logging.logback.EcsEncoder">
<serviceName>${OTEL_SERVICE_NAME:pagopastandintechsupport}</serviceName>
<serviceVersion>${ECS_SERVICE_VERSION:0.0.0}</serviceVersion>
<serviceEnvironment>${ENV:local}</serviceEnvironment>
<serviceName>${OTEL_SERVICE_NAME}</serviceName>
<serviceVersion>${ECS_SERVICE_VERSION}</serviceVersion>
<serviceEnvironment>${ENV}</serviceEnvironment>
</encoder>
</appender>

Expand Down
Loading

0 comments on commit e23e05c

Please sign in to comment.