Skip to content

Commit

Permalink
P4ADEV-1669 init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioT90 committed Dec 16, 2024
1 parent d9b8531 commit d3d7e8a
Show file tree
Hide file tree
Showing 29 changed files with 109 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Add the repository's code owners here
* @pagopa/p4pa-admins @pagopa/payments-cloud-admin
* @pagopa/p4pa-admins @pagopa/payments-cloud-admin @antocalo @Benedetta-fabbri @LarissaASLeite @RiccardoGiuliani @oleksiybozhykntt @ElisKina-dev
45 changes: 45 additions & 0 deletions .github/terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions .github/terraform/00_data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Github
data "github_organization_teams" "all" {
root_teams_only = true
summary_only = true
}

# KV Core
data "azurerm_key_vault" "key_vault_core" {
name = "${var.prefix}-${var.env_short}-${var.location_short}-core-kv"
Expand All @@ -6,12 +12,22 @@ data "azurerm_key_vault" "key_vault_core" {

# Kv Domain
data "azurerm_key_vault" "key_vault_domain" {
name = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}-kv"
name = "${var.prefix}-${var.env_short}-${var.domain}-kv"
resource_group_name = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}-sec-rg"
}

# Github
data "github_organization_teams" "all" {
root_teams_only = true
summary_only = true
# Key Vault - Sonar Token
data "azurerm_key_vault_secret" "sonar_token" {
count = var.env_short == "p" ? 1 : 0

key_vault_id = data.azurerm_key_vault.key_vault_core.id
name = "sonar-cloud-token"
}

# Key Vault - Slack webhok
data "azurerm_key_vault_secret" "slack_webhook" {
count = var.env_short == "p" ? 1 : 0

key_vault_id = data.azurerm_key_vault.key_vault_core.id
name = "slack-webhook-url"
}
22 changes: 11 additions & 11 deletions .github/terraform/99_locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ locals {
CreatedBy = "Terraform"
Environment = var.env
Owner = upper(var.prefix)
Source = "" # Repository URL
CostCenter = ""
Source = "https://github.com/pagopa/p4pa-pagopa-payments" # Repository URL
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}

# Repo
github = {
org = "pagopa"
repository = "" # Repository Name
repository = "p4pa-pagopa-payments" # Repository Name
}

env_secrets = {
ENV_SECRET = "data.azurerm_key_vault_secret.CHANGE_ME.value"
}
env_variables = {
ENV_VARIABLE = "ENV_VARIABLE"
}
env_secrets = {}
env_variables = {}

repo_secrets = var.env_short == "p" ? {
SECRET = "SECRET"
SONAR_TOKEN = data.azurerm_key_vault_secret.sonar_token[0].value
SLACK_WEBHOOK_URL = data.azurerm_key_vault_secret.slack_webhook[0].value
} : {}

repo_env = var.env_short == "p" ? {
ENV_VARIABLE = "ENV_VARIABLE"
SONARCLOUD_PROJECT_NAME = "p4pa-pagopa-payments"
SONARCLOUD_PROJECT_KEY = "pagopa_p4pa-pagopa-payments"
SONARCLOUD_ORG = "pagopa"
} : {}

map_repo = {
Expand Down
2 changes: 1 addition & 1 deletion .github/terraform/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ variable "github_repository_environment" {
default = {
protected_branches = false
custom_branch_policies = true
reviewers_teams = ["CHANGE_ME"]
reviewers_teams = ["p4pa-admins"]
}
}
1 change: 0 additions & 1 deletion .github/terraform/env/itn-dev/backend.ini

This file was deleted.

4 changes: 0 additions & 4 deletions .github/terraform/env/itn-dev/backend.tfvars

This file was deleted.

4 changes: 0 additions & 4 deletions .github/terraform/env/itn-dev/terraform.tfvars

This file was deleted.

2 changes: 1 addition & 1 deletion .github/terraform/env/itn-prod/backend.ini
Original file line number Diff line number Diff line change
@@ -1 +1 @@
subscription=CHANGE_ME
subscription=PROD-P4PA
4 changes: 2 additions & 2 deletions .github/terraform/env/itn-prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "terraform-state-rg"
storage_account_name = "tfappdevCHANGE_ME"
storage_account_name = "tfappprodp4pa"
container_name = "terraform-state"
key = "NAME_OF_REPOSITORY.tfstate"
key = "p4pa-pagopa-payments"
8 changes: 5 additions & 3 deletions .github/terraform/env/itn-prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
prefix = ""
env = "prod"
env_short = "p"
prefix = "p4pa"
env = "prod"
env_short = "p"
domain = "payhub"
location_short = "itn"
1 change: 0 additions & 1 deletion .github/terraform/env/itn-uat/backend.ini

This file was deleted.

4 changes: 0 additions & 4 deletions .github/terraform/env/itn-uat/backend.tfvars

This file was deleted.

3 changes: 0 additions & 3 deletions .github/terraform/env/itn-uat/terraform.tfvars

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codereview.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TEMPLATE-PAYMENTS - Code Review
name: p4pa-pagopa-payments - Code Review

on:
push:
Expand Down
57 changes: 1 addition & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1 @@
# Example Repository Template

This repository serves as an **example template** to kick-start your projects with pre-configured files and folders for **OpenAPI**, **Helm**, **Gradle**, **Java**, and **JUnit testing**. It is designed to streamline the initial setup of new projects and ensure consistency in project structure.

---

## 📂 Repository Structure

Here is a quick overview of the files and directories included in this repository:

```plaintext
.
├── .devops/ # DevOps pipelines
├── .github/ # GitHub configuration files
├── gradle/ # Gradle wrapper files
├── helm/ # Helm charts for Kubernetes deployments
├── openapi/ # OpenAPI specification files
├── src/ # Source code for the Java application
│ ├── main/
│ └── test/
├── build.gradle.kts # Gradle build file
├── Dockerfile # Docker build file
├── README.md # Project documentation
├── settings.gradle.kts # Gradle settings file
└── .gitignore # Git ignore rules
```

## 🚀 Features

### 📜 OpenAPI
- Example OpenAPI specification file (`template-payments-java-repository.openapi.yaml`) to document your RESTful APIs.
- Compatible with tools like Swagger and Postman.

### ⚙️ Helm
- Template Helm charts for deploying your Java application on Kubernetes.
- Includes `values.yaml` for parameter configuration and pre-defined deployment manifests.

### 🔧 Gradle
- `build.gradle` file with dependencies and plugins for building, testing, and running your Java application.
- Compatible with Java 21+.

### ☕ Java
- Example Java application structure with a simple `HelloWorld` class.

### ✅ JUnit
- Example JUnit test cases under the `test/` directory to help you get started with unit testing.

---

## 🛠️ Getting Started

### Prerequisites
Ensure the following tools are installed on your machine:
1. **Java 21+**
2. **Gradle** (or use the Gradle wrapper included in the repository)
3. **Docker** (for Helm-related tasks, optional)
# p4pa-pagopa-payments
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

group = "it.gov.pagopa.payhub"
version = "0.0.1"
description = "template-payments-java-repository"
description = "p4pa-pagopa-payments"

java {
toolchain {
Expand Down Expand Up @@ -92,15 +92,15 @@ configure<SourceSetContainer> {
}

springBoot {
mainClass.value("it.gov.pagopa.template.TemplateApplication")
mainClass.value("it.gov.pagopa.pu.pagopapayments.PagoPaPaymentsApplication")
}

openApiGenerate {
generatorName.set("spring")
inputSpec.set("$rootDir/openapi/template-payments-java-repository.openapi.yaml")
inputSpec.set("$rootDir/openapi/p4pa-pagopa-payments.openapi.yaml")
outputDir.set("$projectDir/build/generated")
apiPackage.set("it.gov.pagopa.template.controller.generated")
modelPackage.set("it.gov.pagopa.template.dto.generated")
apiPackage.set("it.gov.pagopa.pu.pagopapayments.controller.generated")
modelPackage.set("it.gov.pagopa.pu.pagopapayments.dto.generated")
configOptions.set(mapOf(
"dateLibrary" to "java8",
"requestMappingMode" to "api_interface",
Expand Down
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: template-payments-java-repository
description: TEMPLATE PAYMENTS JAVA REPOSITORY
name: p4pa-pagopa-payments
description: p4pa-pagopa-payments
type: application
version: 1.0.0
appVersion: 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
microservice-chart:
image:
repository: p4paditncorecommonacr.azurecr.io/templatepaymentsjavarepository
repository: p4paditncorecommonacr.azurecr.io/p4papagopapayments
tag: latest
pullPolicy: Always

Expand Down
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
microservice-chart:
image:
repository: p4papitncorecommonacr.azurecr.io/templatepaymentsjavarepository
repository: p4papitncorecommonacr.azurecr.io/p4papagopapayments
tag: latest
pullPolicy: Always

Expand Down
2 changes: 1 addition & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
microservice-chart:
image:
repository: p4pauitncorecommonacr.azurecr.io/templatepaymentsjavarepository
repository: p4pauitncorecommonacr.azurecr.io/p4papagopapayments
tag: latest
pullPolicy: Always

Expand Down
4 changes: 2 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ microservice-chart:

ingress:
create: true
path: /templatepaymentsjavarepository/(.*)
path: /p4papagopapayments/(.*)

serviceAccount:
create: false
Expand All @@ -55,7 +55,7 @@ microservice-chart:
key: applicationinsights.json

envConfig:
APPLICATIONINSIGHTS_ROLE_NAME: "templatepaymentsjavarepository"
APPLICATIONINSIGHTS_ROLE_NAME: "p4pa-pagopa-payments"
APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL: "OFF"
APPLICATIONINSIGHTS_INSTRUMENTATION_MICROMETER_ENABLED: "false"
APPLICATIONINSIGHTS_PREVIEW_PROFILER_ENABLED: "false"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
openapi: 3.1.0
info:
title: Fake API
title: p4pa-pagopa-payments
description: "Sample API"
version: "1.0.0"
version: Api and Models
paths:
/api/v1/greet:
get:
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "template-payments-java-repository"
rootProject.name = "p4pa-pagopa-payments"
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package it.gov.pagopa.template;
package it.gov.pagopa.pu.pagopapayments;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TemplateApplication {
public class PagoPaPaymentsApplication {

public static void main(String[] args) {
SpringApplication.run(TemplateApplication.class, args);
SpringApplication.run(PagoPaPaymentsApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.gov.pagopa.template.config;
package it.gov.pagopa.pu.pagopapayments.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/it/gov/pagopa/template/utils/Calculator.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.gov.pagopa.template.config;
package it.gov.pagopa.pu.pagopapayments.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
Expand Down
Loading

0 comments on commit d3d7e8a

Please sign in to comment.