Skip to content

Commit

Permalink
Merge pull request #1 from pagopa/VAS-835-feat-add-compression-function
Browse files Browse the repository at this point in the history
[VAS-835] feat: add compression function
  • Loading branch information
alessio-cialini authored May 24, 2024
2 parents d8516a6 + 96b8926 commit 9bf983d
Show file tree
Hide file tree
Showing 94 changed files with 4,162 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .devops/performance-test-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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"
- "load"
- "spike"
- "stress"
default: "constant"
- name: "SCRIPT"
displayName: "Script name"
type: string
values:
- receipt_generator
- name: "DB_NAME"
displayName: "DB name"
type: string
values:
- pagopa_receipt_pdf_generatork6
- name: "PROCESS_TIME"
displayName: "Process time"
type: number
default: 5

variables:
${{ if eq(parameters['ENVIRONMENT'], 'dev') }}:
receiptCosmosSubscriptionKey: "$(DEV_RECEIPT_COSMOS_DB_SUBSCRIPTION_KEY)"
receiptQueueAccountName: "pagopadweureceiptsfnsa"
receiptQueueName: "pagopa-d-weu-receipts-queue-receipt-waiting-4-gen"
azureSubscription: "$(TF_DEV_AZURE_SERVICE_CONNECTION)"
poolImage: "pagopa-dev-loadtest-linux"
${{ if eq(parameters['ENVIRONMENT'], 'uat') }}:
receiptCosmosSubscriptionKey: "$(UAT_RECEIPT_COSMOS_DB_SUBSCRIPTION_KEY)"
receiptQueueAccountName: "pagopauweureceiptsfnsa"
receiptQueueName: "pagopa-u-weu-receipts-queue-receipt-waiting-4-gen"
azureSubscription: "$(TF_UAT_AZURE_SERVICE_CONNECTION)"
poolImage: "pagopa-uat-loadtest-linux"

pool:
name: $(poolImage)

steps:
- script: |
cd ./performance-test/src
docker pull grafana/k6
displayName: Pull k6 image
- script: |
apt-get update
apt-get install azure-cli
az version
displayName: Install Azure CLI
- task: AzureCLI@2
displayName: Login Azure
inputs:
azureSubscription: "$(azureSubscription)"
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
end="$(date -d '+1 day' +'%Y-%m-%d')"
export SAS_TOKEN="$(az storage queue generate-sas \
-n ${{ variables.receiptQueueName }} \
--account-name ${{ variables.receiptQueueAccountName }} \
--permissions apru \
--expiry $end)"
echo "##vso[task.setvariable variable=SAS_TOKEN]$SAS_TOKEN"
- script: |
cd ./performance-test
sh ./run_performance_test.sh ${{ parameters.ENVIRONMENT }} ${{ parameters.TEST_TYPE }} ${{ parameters.SCRIPT }} ${{ parameters.DB_NAME }} $(SAS_TOKEN) $RECEIPT_COSMOS_SUBSCRIPTION_KEY $PROCESS_TIME
displayName: Run k6 ${{ parameters.SCRIPT }} on ${{ parameters.ENVIRONMENT }}
env:
RECEIPT_COSMOS_SUBSCRIPTION_KEY: ${{ variables.receiptCosmosSubscriptionKey }}
PROCESS_TIME: ${{ parameters.PROCESS_TIME }}
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FUNCTIONS_WORKER_RUNTIME=java
AzureWebJobsStorage=DefaultEndpointsProtocol=https;AccountName=<YOUR_STORAGE_KEY>
36 changes: 36 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--- Please always add a PR description as if nobody knows anything about the context these changes come from. -->
<!--- Even if we are all from our internal team, we may not be on the same page. -->
<!--- Write this PR as you were contributing to a public OSS project, where nobody knows you and you have to earn their trust. -->
<!--- This will improve our projects in the long run! Thanks. -->

#### List of Changes

<!--- Describe your changes in detail -->

#### Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

#### How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

#### Screenshots (if appropriate):

#### Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

#### Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
3 changes: 3 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addAssignees: author

runOnDraft: true
18 changes: 18 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# release.yml

changelog:
exclude:
labels:
- ignore-for-release
authors:
- pagopa-github-bot
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: Exciting New Features 🎉
labels:
- enhancement
- title: Other Changes
labels:
- "*"
54 changes: 54 additions & 0 deletions .github/workflows/anchore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, builds an image, performs a container image
# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security
# code scanning feature. For more information on the Anchore scan action usage
# and parameters, see https://github.com/anchore/scan-action. For more
# information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype
name: Anchore Container Scan

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '00 07 * * *'

permissions:
contents: read

env:
DOCKERFILE: Dockerfile

jobs:
Anchore-Build-Scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Build the Docker image
run: docker build . --file ${{ env.DOCKERFILE }} --tag localbuild/testimage:latest

- name: Run the Anchore scan action itself with GitHub Advanced Security code scanning integration enabled
uses: anchore/scan-action@v3
with:
image: "localbuild/testimage:latest"
acs-report-enable: true
fail-build: true
severity-cutoff: "high"
- name: Upload Anchore Scan Report
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: results.sarif
Loading

0 comments on commit 9bf983d

Please sign in to comment.