Skip to content

Commit

Permalink
Merge pull request #2 from pagopa/PRDP-232-migrate-recoverFailed
Browse files Browse the repository at this point in the history
[PRDP-232] feat: migrate recover failed
  • Loading branch information
pasqualespica authored Nov 28, 2023
2 parents e973efc + cb4c39a commit ac7574d
Show file tree
Hide file tree
Showing 134 changed files with 6,970 additions and 303 deletions.
106 changes: 106 additions & 0 deletions .devops/performance-test-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# azure-pipelines.yml
trigger: none

parameters:
- name: "ENVIRONMENT"
displayName: "Environment"
type: string
values:
- "dev"
- "uat"
default: "uat"
- name: "TEST_TYPE"
displayName: "Test type"
type: string
values:
- "constant"
- "constant-prod"
- "load"
- "spike"
- "stress"
default: "constant"
- name: "SCRIPT"
displayName: "Script name"
type: string
values:
- receipt_processor
- receipt_flow_simulation
default: "receipt_processor"
- name : "SLEEP_INTERVAL"
displayName: "Sleep before monitoring"
type: number
default: 300
- name: "DB_NAME"
displayName: "DB name"
type: string
values:
- pagopa_receipt_pdf_helpdeskk6

variables:
${{ if eq(parameters['ENVIRONMENT'], 'dev') }}:
receiptCosmosSubscriptionKey: "$(DEV_RECEIPT_COSMOS_DB_SUBSCRIPTION_KEY)"
bizEventCosmosSubscriptionKey: "$(DEV_BIZEVENT_COSMOS_DB_SUBSCRIPTION_KEY)"
blobStorageConnectionString: "$(DEV_BLOB_STORAGE_CONNECTION_STRING)"
receiptCosmosConnectionString: "$(DEV_RECEIPT_COSMOS_DB_CONNECTION_STRING)"
bizeventCosmosConnectionString: "$(DEV_BIZ_COSMOS_DB_CONNECTION_STRING)"
poolImage: "pagopa-dev-loadtest-linux"
${{ if eq(parameters['ENVIRONMENT'], 'uat') }}:
receiptCosmosSubscriptionKey: "$(UAT_RECEIPT_COSMOS_DB_SUBSCRIPTION_KEY)"
bizEventCosmosSubscriptionKey: "$(UAT_BIZEVENT_COSMOS_DB_SUBSCRIPTION_KEY)"
blobStorageConnectionString: "$(UAT_BLOB_STORAGE_CONNECTION_STRING)"
receiptCosmosConnectionString: "$(UAT_RECEIPT_COSMOS_DB_CONNECTION_STRING)"
bizeventCosmosConnectionString: "$(UAT_BIZ_COSMOS_DB_CONNECTION_STRING)"
poolImage: "pagopa-uat-loadtest-linux"

pool:
name: $(poolImage)

steps:
- script: |
cd ./performance-test/src
docker pull grafana/k6
displayName: Pull k6 image
- script: |
cd ./performance-test
sh ./run_performance_test.sh ${{ parameters.ENVIRONMENT }} ${{ parameters.TEST_TYPE }} ${{ parameters.SCRIPT }} ${{ parameters.DB_NAME }} $BIZEVENT_COSMOS_SUBSCRIPTION_KEY $RECEIPT_COSMOS_SUBSCRIPTION_KEY
displayName: Run k6 ${{ parameters.SCRIPT }} on ${{ parameters.ENVIRONMENT }}
env:
RECEIPT_COSMOS_SUBSCRIPTION_KEY: ${{ variables.receiptCosmosSubscriptionKey }}
BIZEVENT_COSMOS_SUBSCRIPTION_KEY: ${{ variables.bizEventCosmosSubscriptionKey }}
- script: |
sleep ${{ parameters.SLEEP_INTERVAL}}
displayName: Wait receipt to be processed
condition: ${{ eq(parameters['SCRIPT'], 'receipt_flow_simulation') }}
- script: |
cd ./performance-test/src
docker build -f ./DockerfileReview -t exec-node .
docker run --rm --name initToRunk6 \
-e BLOB_STORAGE_CONN_STRING=${BLOB_STORAGE_CONN_STRING} \
-e RECEIPT_COSMOS_CONN_STRING=${RECEIPT_COSMOS_CONN_STRING} \
-e BIZEVENT_COSMOS_CONN_STRING=${BIZEVENT_COSMOS_CONN_STRING} \
-e ENVIRONMENT_STRING="${ENVIRONMENT_STRING}" \
exec-node
displayName: Run Receipts Timestamp Review
condition: ${{ eq(parameters['SCRIPT'], 'receipt_flow_simulation') }}
env:
RECEIPT_COSMOS_CONN_STRING: ${{ variables.receiptCosmosConnectionString }}
BIZEVENT_COSMOS_CONN_STRING: ${{ variables.bizeventCosmosConnectionString }}
BLOB_STORAGE_CONN_STRING: ${{ variables.blobStorageConnectionString }}
ENVIRONMENT_STRING: ${{ parameters.ENVIRONMENT }}
# - script: |
# cd ./performance-test/src
# docker build -f ./DockerfileTeardown -t exec-node .
# docker run --rm --name initToRunk6 \
# -e BLOB_STORAGE_CONN_STRING=${BLOB_STORAGE_CONN_STRING} \
# -e RECEIPT_COSMOS_CONN_STRING=${RECEIPT_COSMOS_CONN_STRING} \
# -e BIZEVENT_COSMOS_CONN_STRING=${BIZEVENT_COSMOS_CONN_STRING} \
# -e ENVIRONMENT_STRING="${ENVIRONMENT_STRING}" \
# exec-node
# displayName: Run Receipts Teardown
# condition: ${{ eq(parameters['SCRIPT'], 'receipt_flow_simulation') }}
# env:
# RECEIPT_COSMOS_CONN_STRING: ${{ variables.receiptCosmosConnectionString }}
# BIZEVENT_COSMOS_CONN_STRING: ${{ variables.bizeventCosmosConnectionString }}
# BLOB_STORAGE_CONN_STRING: ${{ variables.blobStorageConnectionString }}
# ENVIRONMENT_STRING: ${{ parameters.ENVIRONMENT }}

21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FUNCTIONS_WORKER_RUNTIME=java
AzureWebJobsStorage=DefaultEndpointsProtocol=https;AccountName=<YOUR_STORAGE_KEY>

RECEIPT_QUEUE_CONN_STRING=DefaultEndpointsProtocol=https;AccountName=<YOUR_STORAGE_KEY>
RECEIPT_QUEUE_TOPIC=pagopa-d-weu-receipts-queue-receipt-waiting-4-gen
RECEIPT_QUEUE_DELAY=1

COSMOS_BIZ_EVENT_CONN_STRING=AccountEndpoint=https://pagopa-d-weu-bizevents-ds-cosmos-account.documents.azure.com:443/;AccountKey=<YOUR_COSMOS_KEY>
COSMOS_RECEIPTS_CONN_STRING=AccountEndpoint=https://pagopa-d-weu-receipts-ds-cosmos-account.documents.azure.com:443/;AccountKey=<YOUR_COSMOS_KEY>

COSMOS_RECEIPT_SERVICE_ENDPOINT=https://pagopa-d-weu-receipts-ds-cosmos-account.documents.azure.com:443/
COSMOS_RECEIPT_KEY=<YOUR_COSMOS_KEY>
COSMOS_RECEIPT_DB_NAME=db
COSMOS_RECEIPT_CONTAINER_NAME=receipts

COSMOS_BIZ_EVENT_SERVICE_ENDPOINT=https://pagopa-d-weu-bizevents-ds-cosmos-account.documents.azure.com:443/
COSMOS_BIZ_EVENT_KEY=<YOUR_COSMOS_KEY>
COSMOS_BIZ_EVENT_DB_NAME=db
COSMOS_BIZ_EVENT_CONTAINER_NAME=biz-events

MAX_DATE_DIFF_MILLIS=360000
101 changes: 101 additions & 0 deletions .github/maven_code_review/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Maven Code Review
description: "Code Review for Pull Request"

inputs:
github_token:
required: true
type: string
description: Github Token
sonar_token:
required: true
type: string
description: Sonar Token for the login
project_key:
required: true
type: string
description: Key of the project on SonarCloud
coverage_exclusions:
required: false
type: string
description: Files to exclude from coverage
default: '**/config/*,**/*Mock*,**/model/**,**/entity/*'
cpd_exclusions:
required: false
type: string
description: Files to exclude from code duplication
default: '**/model/**,**/entity/*'
jdk_version:
required: true
type: string
description: JDK version
default: 11
maven_version:
required: true
type: string
description: Maven version
default: 3.8.2

runs:
using: "composite"
steps:
- uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ inputs.jdk_version }}

- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: ${{ inputs.maven_version }}

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar-project.properties/cache
key: ${{ runner.os }}-sonar-project.properties
restore-keys: ${{ runner.os }}-sonar-project.properties

- name: Build and analyze on Pull Requests
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Dsonar.organization=pagopa
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
-Dsonar.coverage.jacoco.xmlReportPaths=./target/jacoco-report/jacoco.xml
-Dsonar.coverage.exclusions=${{inputs.coverage_exclusions}}
-Dsonar.cpd.exclusions=${{inputs.cpd_exclusions}}
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=${{ inputs.sonar_token }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ inputs.github_token }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ inputs.sonar_token }}

- name: Build and analyze on Push main
if: ${{ github.event_name != 'pull_request' }}
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
SONAR_TOKEN: ${{ inputs.sonar_token }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Dsonar.organization=pagopa
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
-Dsonar.coverage.jacoco.xmlReportPaths=./target/site/jacoco/jacoco.xml
-Dsonar.coverage.exclusions=${{inputs.coverage_exclusions}}
-Dsonar.cpd.exclusions=${{inputs.cpd_exclusions}}
-Dsonar.branch.name=${{ github.head_ref }}
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=${{ inputs.sonar_token }}
26 changes: 0 additions & 26 deletions .github/workflows/assignee.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/check_metadata_pr.yml

This file was deleted.

Loading

0 comments on commit ac7574d

Please sign in to comment.