-
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 0a7e4e1
Showing
24 changed files
with
710 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,62 @@ | ||
# Deploy to Azure Kubernetes Service | ||
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- '*' | ||
paths: | ||
include: | ||
- app/* | ||
- Dockerfiles/* | ||
- launch.sh | ||
- pyproject.toml | ||
- .* | ||
|
||
pr: | ||
- main | ||
- master | ||
- develop | ||
|
||
resources: | ||
- repo: self | ||
|
||
variables: | ||
dockerfileRelativePath: '$(DOCKERFILE)' # Dockerfile | ||
|
||
# Agent VM image name for Build | ||
vmImageNameDefault: 'ubuntu-latest' | ||
|
||
# Image Repository Name | ||
imageRepository: '$(docker_image_repository_name)' | ||
|
||
environment: 'LAB' | ||
dockerRegistryServiceConnection: '$(LAB_CONTAINER_REGISTRY_SERVICE_CONN)' | ||
containerRegistry: '$(LAB_CONTAINER_REGISTRY_NAME)' | ||
selfHostedAgentPool: $(LAB_AGENT_POOL) | ||
|
||
stages: | ||
- stage: 'build_and_publish_docker' | ||
displayName: 'build_and_pusblih_to_${{ variables.environment }}' | ||
dependsOn: [] | ||
jobs: | ||
- job: build_and_publish_docker_image | ||
displayName: build docker image | ||
pool: | ||
vmImage: $(vmImageNameDefault) | ||
steps: | ||
- task: CmdLine@2 | ||
inputs: | ||
script: 'ls -la' | ||
- task: Docker@2 | ||
displayName: 'publish_image_to_${{ variables.environment }}' | ||
condition: succeeded() | ||
inputs: | ||
command: 'buildAndPush' | ||
containerRegistry: '$(dockerRegistryServiceConnection)' | ||
repository: '$(imageRepository)' | ||
Dockerfile: '$(Build.Repository.LocalPath)/$(dockerfileRelativePath)' | ||
tags: | | ||
$(Build.SourceBranchName)-$(Build.BuildId) | ||
latest |
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,26 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
# 4 space indentation | ||
[*.{py,java,r,R}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# 2 space indentation | ||
[*.{js,json,y{a,}ml,html,cwl}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{md,Rmd,rst}] | ||
trim_trailing_whitespace = false | ||
indent_style = space | ||
indent_size = 2 |
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,8 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
exclude = .venv, docs, .vscode, pychache, .git,__pycache__,__init__.py,.mypy_cache,.pytest_cache | ||
ignore = E501, W503, E226, E203, W503, W293, I004, E266, W391, W292, I001 | ||
# E501: Line too long | ||
# W503: Line break occurred before binary operator | ||
# E226: Missing white space around arithmetic operator | ||
# I001: Import wrong positions |
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,30 @@ | ||
<!--- 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: --> | ||
- [ ] Chore (nothing changes by a user perspective) | ||
- [ ] 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,47 @@ | ||
name: Beta docker on dev branch | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/heads | ||
branches-ignore: | ||
- 'main' | ||
paths-ignore: | ||
- 'CODEOWNERS' | ||
- '**.md' | ||
- '.**' | ||
|
||
jobs: | ||
release: | ||
name: Beta docker on dev branch | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
# from https://github.com/actions/checkout/commits/main | ||
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Log in to the Container registry | ||
id: docker_login | ||
# from https://github.com/docker/login-action/commits/master | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
id: docker_build_push | ||
# from https://github.com/docker/build-push-action/commits/master | ||
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:beta-${{ github.ref_name }} | ||
labels: | | ||
maintainer=https://pagopa.it | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} |
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,56 @@ | ||
name: "Validate PR title" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# Please look up the latest version from | ||
# https://github.com/amannn/action-semantic-pull-request/releases | ||
# from https://github.com/amannn/action-semantic-pull-request/commits/main | ||
- uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# Configure which types are allowed. | ||
# Default: https://github.com/commitizen/conventional-commit-types | ||
types: | | ||
fix | ||
feat | ||
docs | ||
chore | ||
breaking | ||
# Configure that a scope must always be provided. | ||
requireScope: false | ||
# Configure additional validation for the subject based on a regex. | ||
# This example ensures the subject starts with an uppercase character. | ||
subjectPattern: ^[A-Z].+$ | ||
# If `subjectPattern` is configured, you can use this property to override | ||
# the default error message that is shown when the pattern doesn't match. | ||
# The variables `subject` and `title` can be used within the message. | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
starts with an uppercase character. | ||
# For work-in-progress PRs you can typically use draft pull requests | ||
# from Github. However, private repositories on the free plan don't have | ||
# this option and therefore this action allows you to opt-in to using the | ||
# special "[WIP]" prefix to indicate this state. This will avoid the | ||
# validation of the PR title and the pull request checks remain pending. | ||
# Note that a second check will be reported if this is enabled. | ||
wip: true | ||
# When using "Squash and merge" on a PR with only one commit, GitHub | ||
# will suggest using that commit message instead of the PR title for the | ||
# merge commit, and it's easy to commit this by mistake. Enable this option | ||
# to also validate the commit message for one commit PRs. | ||
validateSingleCommit: false | ||
# Related to `validateSingleCommit` you can opt-in to validate that the PR | ||
# title matches a single commit to avoid confusion. | ||
validateSingleCommitMatchesPrTitle: false |
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,62 @@ | ||
name: Release | ||
|
||
on: | ||
# Trigger the workflow on push on the main branch | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'CODEOWNERS' | ||
- '**.md' | ||
- '.**' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
# from https://github.com/actions/checkout/commits/main | ||
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Release | ||
id: release | ||
# from https://github.com/cycjimmy/semantic-release-action/commits/main | ||
uses: cycjimmy/semantic-release-action@bdd914ff2423e2792c73475f11e8da603182f32d | ||
with: | ||
semantic_version: 18.0.0 | ||
extra_plugins: | | ||
@semantic-release/[email protected] | ||
@semantic-release/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Log in to the Container registry | ||
id: docker_login | ||
if: steps.release.outputs.new_release_published == 'true' | ||
# from https://github.com/docker/login-action/commits/master | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
id: docker_build_push | ||
if: steps.release.outputs.new_release_published == 'true' | ||
# from https://github.com/docker/build-push-action/commits/master | ||
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:latest | ||
ghcr.io/${{ github.repository }}:v${{ steps.release.outputs.new_release_version }} | ||
labels: | | ||
maintainer=https://pagopa.it | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} |
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,52 @@ | ||
# 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. | ||
|
||
name: Docker security scan | ||
|
||
on: | ||
push: | ||
branches: [ "main", "master" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "main", "master" ] | ||
schedule: | ||
- cron: '00 07 * * *' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
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 | ||
name: Build | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
# from https://github.com/actions/checkout/commits/main | ||
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | ||
|
||
- name: Build an image from Dockerfile | ||
run: | | ||
docker build -t docker.io/my-organization/my-app:${{ github.sha }} . | ||
- name: Run Trivy vulnerability scanner | ||
# from https://github.com/aquasecurity/trivy-action/commits/master | ||
uses: aquasecurity/trivy-action@d63413b0a4a4482237085319f7f4a1ce99a8f2ac | ||
with: | ||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' | ||
format: 'template' | ||
template: '@/contrib/sarif.tpl' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL,HIGH' | ||
timeout: '10m0s' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
# from https://github.com/github/codeql-action/commits/main | ||
uses: github/codeql-action/upload-sarif@f0a12816612c7306b485a22cb164feb43c6df818 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
Oops, something went wrong.