generated from pagopa/template-java-spring-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d9fd0e6
Showing
113 changed files
with
5,845 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# 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: | ||
- "load" | ||
- "smoke" | ||
- "soak" | ||
- "spike" | ||
- "stress" | ||
- "constant" | ||
- # TODO: add your values | ||
default: "constant" | ||
- name: "SCRIPT" | ||
displayName: "Script name" | ||
type: string | ||
values: | ||
- yourscriptname # TODO: add your script | ||
variables: | ||
${{ if eq(parameters['ENVIRONMENT'], 'dev') }}: | ||
poolImage: 'pagopa-dev-loadtest-linux' | ||
API_SUBSCRIPTION_KEY: $(DEV_API_SUBSCRIPTION_KEY) | ||
${{ if eq(parameters['ENVIRONMENT'], 'uat') }}: | ||
poolImage: 'pagopa-uat-loadtest-linux' | ||
API_SUBSCRIPTION_KEY: $(UAT_API_SUBSCRIPTION_KEY) | ||
|
||
|
||
pool: | ||
name: $(poolImage) | ||
|
||
steps: | ||
- script: | | ||
cd ./performance-test/src | ||
docker pull grafana/k6 | ||
displayName: Pull k6 image | ||
# TODO: add your env params | ||
- script: | | ||
cd ./performance-test | ||
sh ./run_performance_test.sh ${{ parameters.ENVIRONMENT }} ${{ parameters.TEST_TYPE }} ${{ parameters.SCRIPT }} afmcalculatork6 $(API_SUBSCRIPTION_KEY) | ||
displayName: Run k6 ${{ parameters.SCRIPT }} on ${{ parameters.ENVIRONMENT }} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
addAssignees: author | ||
|
||
runOnDraft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# release.yml | ||
|
||
changelog: | ||
exclude: | ||
labels: | ||
- ignore-for-release | ||
- skip | ||
authors: | ||
- pagopa-github-bot | ||
categories: | ||
- title: Breaking Changes 🛠 | ||
labels: | ||
- breaking-change | ||
- major | ||
- title: Exciting New Features 🎉 | ||
labels: | ||
- enhancement | ||
- minor | ||
- title: Bug Fixing 🔥 | ||
labels: | ||
- bug | ||
- patch | ||
- title: Other Changes | ||
labels: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
name: Check PR | ||
|
||
# Controls when the workflow will run | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: [ opened, synchronize, labeled, unlabeled, reopened, edited ] | ||
|
||
|
||
permissions: | ||
pull-requests: write | ||
|
||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
auto_assign: | ||
name: Auto Assign | ||
|
||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Assign Me | ||
# You may pin to the exact commit or the version. | ||
uses: kentaro-m/[email protected] | ||
with: | ||
configuration-path: '.github/auto_assign.yml' | ||
|
||
check_labels: | ||
name: Check Required Labels | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Verify PR Labels | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'major') && !contains(github.event.pull_request.labels.*.name, 'minor') && !contains(github.event.pull_request.labels.*.name, 'patch') && !contains(github.event.pull_request.labels.*.name, 'patch') && !contains(github.event.pull_request.labels.*.name, 'skip') }} | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var comments = await github.rest.issues.listComments({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
for (const comment of comments.data) { | ||
if (comment.body.includes('This pull request does not contain a valid label')){ | ||
github.rest.issues.deleteComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
comment_id: comment.id | ||
}) | ||
} | ||
} | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'This pull request does not contain a valid label. Please add one of the following labels: `[major, minor, patch, patch, skip]`' | ||
}) | ||
core.setFailed('Missing required labels') | ||
check_size: | ||
runs-on: ubuntu-latest | ||
name: Check Size | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check Size | ||
uses: actions/[email protected] | ||
env: | ||
IGNORED_FILES: openapi.json, api-docs.json | ||
BRANCH_NAME: ${{ github.head_ref}} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const additions = context.payload.pull_request.additions || 0 | ||
const deletions = context.payload.pull_request.deletions || 0 | ||
var changes = additions + deletions | ||
console.log('additions: '+additions+' + deletions: '+deletions+ ' = total changes: ' + changes); | ||
const { IGNORED_FILES, BRANCH_NAME } = process.env | ||
const ignored_files = IGNORED_FILES.trim().split(',').filter(word => word.length > 0); | ||
if (ignored_files.length > 0){ | ||
var ignored = 0 | ||
const execSync = require('child_process').execSync; | ||
for (const file of IGNORED_FILES.trim().split(',')) { | ||
const ignored_additions_str = execSync('git --no-pager diff --numstat origin/main..origin/'+BRANCH_NAME+' | grep ' + file + ' | cut -f 1', { encoding: 'utf-8' }) | ||
const ignored_deletions_str = execSync('git --no-pager diff --numstat origin/main..origin/'+BRANCH_NAME+' | grep ' + file + ' | cut -f 2', { encoding: 'utf-8' }) | ||
const ignored_additions = ignored_additions_str.split('\n').map(elem=> parseInt(elem || 0)).reduce( | ||
(accumulator, currentValue) => accumulator + currentValue, | ||
0); | ||
const ignored_deletions = ignored_deletions_str.split('\n').map(elem=> parseInt(elem || 0)).reduce( | ||
(accumulator, currentValue) => accumulator + currentValue, | ||
0); | ||
ignored += ignored_additions + ignored_deletions; | ||
} | ||
changes -= ignored | ||
console.log('ignored lines: ' + ignored + ' , consider changes: ' + changes); | ||
} | ||
var labels = await github.rest.issues.listLabelsOnIssue({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
if (changes <= 400){ | ||
if (labels.data.find(label => label.name == 'size/large')){ | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: 'size/large' | ||
}) | ||
} | ||
} | ||
if (changes >= 200){ | ||
if (labels.data.find(label => label.name == 'size/small')){ | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: 'size/small' | ||
}) | ||
} | ||
} | ||
var comments = await github.rest.issues.listComments({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
for (const comment of comments.data) { | ||
if (comment.body.includes('This PR exceeds the recommended size')){ | ||
github.rest.issues.deleteComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
comment_id: comment.id | ||
}) | ||
} | ||
} | ||
if (changes < 200){ | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['size/small'] | ||
}) | ||
} | ||
if (changes > 400){ | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['size/large'] | ||
}) | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'This PR exceeds the recommended size of 400 lines. Please make sure you are NOT addressing multiple issues with one PR. _Note this PR might be rejected due to its size._' | ||
}) | ||
} | ||
Oops, something went wrong.