Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPD-243] Helm, Dockefile and CD Pipeline #2

Merged
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
27fa773
lint
jacopocarlini Jul 18, 2022
3bbd1e7
pipeline
jacopocarlini Jul 18, 2022
d8a2534
pipeline danger CI
jacopocarlini Jul 18, 2022
43b3d88
Update code-review-pipelines.yml for Azure Pipelines
jacopocarlini Jul 18, 2022
e68f753
fix pipeline danger CI
jacopocarlini Jul 18, 2022
3b0b110
check input
jacopocarlini Jul 19, 2022
3abf261
fix
jacopocarlini Jul 19, 2022
4f47ad6
try
jacopocarlini Jul 19, 2022
473f9e2
openapi.json
jacopocarlini Jul 20, 2022
aa96330
[PPD-243] helm, Dockerfile added
jacopocarlini Jul 21, 2022
cae5456
[PPD-243] fix pipeline
jacopocarlini Jul 21, 2022
fd06cbd
Bump version to 1.0.1 [skip ci]
Jul 21, 2022
e93f75f
fix
jacopocarlini Jul 21, 2022
dcee53a
Merge remote-tracking branch 'origin/PPD-243-creazione-infra-microser…
jacopocarlini Jul 21, 2022
b67db17
fix
jacopocarlini Jul 21, 2022
4cda291
[PPD-243] deploy pipeline
jacopocarlini Jul 22, 2022
aa908b4
Update deploy-pipelines.yml for Azure Pipelines
jacopocarlini Jul 22, 2022
82063fe
Bump version to 1.0.2-0 [skip ci]
Jul 22, 2022
dcf2408
fix pipeline
jacopocarlini Jul 22, 2022
383a4eb
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
b80a36f
Bump version to 1.0.2-1 [skip ci]
Jul 22, 2022
0929528
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
e6540cb
Merge remote-tracking branch 'origin/PPD-243-creazione-infra-microser…
jacopocarlini Jul 22, 2022
a212aa2
Bump version to 1.0.2-2 [skip ci]
Jul 22, 2022
eb94184
Merge branch 'main' into PPD-243-creazione-infra-microservizio-donazi…
jacopocarlini Jul 22, 2022
66f4893
Merge remote-tracking branch 'origin/PPD-243-creazione-infra-microser…
jacopocarlini Jul 22, 2022
55982af
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
db628db
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
b88f976
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
3d556a4
fix
jacopocarlini Jul 22, 2022
cf85eae
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
6d9962c
[PPD-243] fix deploy pipeline
jacopocarlini Jul 22, 2022
5be71f2
fix
jacopocarlini Jul 22, 2022
5a17355
Bump version to 1.0.2-3 [skip ci]
Jul 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .devops/azure-templates/node-versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Node Github Relase steps
# Mark a release on the project repository, with version bump and tag,
# and publish a release on Github

parameters:

# Versioning parameters
- name: 'semver'
type: string
values:
- major
- minor
- patch
- prerelease
- skip

# This is the branch in which we will push the release tag.
# It'll be master, but it can be overridden
# Basically, this variable is used to enforce the fact that we use the very same branch in different steps
- name: 'release_branch'
type: string
default: master

# Github parameters
- name: 'gitUsername'
type: string
- name: 'gitEmail'
type: string
- name: 'gitHubConnection'
type: string


steps:
- ${{ if ne(parameters.semver, 'skip') }}:
# setup git author
- script: |
git config --global user.email "${{ parameters.gitEmail }}" && git config --global user.name "${{ parameters.gitUsername }}"
displayName: 'Git setup'

# Without this step, changes would be applied to a detached head
- script: |
git checkout ${{ parameters.release_branch }}
displayName: 'Checkout release branch'

# bump version
- script: |
npm version ${{ parameters.semver }} -m "Bump version to %s [skip ci]"
NEXT_VERSION=$(node -p "require('./package.json').version")
RELEASE_TAG="v$NEXT_VERSION-RELEASE"
git tag $RELEASE_TAG
displayName: 'Version bump and tag'
- script: |
NEXT_VERSION=$(node -p "require('./package.json').version")
HEAD_SHA=$(git rev-parse HEAD)
TITLE="Release $NEXT_VERSION"
TAG="v$NEXT_VERSION-RELEASE"
echo "##vso[task.setvariable variable=title]$TITLE"
echo "##vso[task.setvariable variable=sha]$HEAD_SHA"
echo "##vso[task.setvariable variable=tag]$TAG"
displayName: 'Set release variables'

# push new version
- script: |
git push origin ${{ parameters.release_branch }} && git push --tags
displayName: 'Push to the release branch'

# create new releae
- task: GitHubRelease@0
inputs:
gitHubConnection: ${{ parameters.gitHubConnection }}
repositoryName: $(Build.Repository.Name)
action: create
target: $(sha)
tagSource: manual
tag: $(tag)
title: $(title)
addChangelog: true
131 changes: 131 additions & 0 deletions .devops/code-review-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Azure DevOps pipeline to build, check source codes and run tests.
#
# To make Danger JS run on a pull request you need to add the following pipeline
# variable and set it with a GitHub access token (scope public_repo); otherwise
# set its value to 'skip' without marking it secret:
# - DANGER_GITHUB_API_TOKEN
#

# Automatically triggered on PR
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#pr-trigger
trigger: none


variables:
NODE_VERSION: '14.19.0'
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn


# Execute agents (jobs) on latest Ubuntu version.
# To change OS for a specific, override "pool" attribute inside the job definition
pool:
vmImage: 'ubuntu-latest'

resources:
repositories:
- repository: pagopaCommons
type: github
name: pagopa/azure-pipeline-templates
ref: refs/tags/v15
endpoint: 'io-azure-devops-github-ro'


stages:
- stage: Build
dependsOn: []
jobs:
- job: make_build
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons
- script: |
yarn build
displayName: 'Build'

- stage: Static_analysis
dependsOn: []
jobs:
- job: lint
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons
- script: |
yarn lint
displayName: 'Lint'

- job: danger
condition:
and(
succeeded(),
ne(variables['DANGER_GITHUB_API_TOKEN'], 'skip')
)
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons

- bash: |
yarn danger ci
env:
DANGER_GITHUB_API_TOKEN: '$(DANGER_GITHUB_API_TOKEN)'
displayName: 'Danger CI'


# B) Run unit tests if there is a push or pull request on any branch.
- stage: Test
dependsOn: []
jobs:
- job: unit_tests
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons

- script: |
yarn test:coverage
displayName: 'Unit tests exec'

- stage: Sonarcloud
dependsOn: []
jobs:
- job: sonarcloud_analysis
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons

- script: git branch
displayName: 'Branch identification'

- task: SonarCloudPrepare@1
displayName: 'Prepare SonarCloud analysis configuration'
inputs:
SonarCloud: '$(SONARCLOUD_SERVICE_CONN)'
organization: '$(SONARCLOUD_ORG)'
scannerMode: Other
projectKey: $(SONARCLOUD_PROJECT_KEY)
projectName: $(SONARCLOUD_PROJECT_NAME)
# scannerMode: CLI
# configMode: manual
# cliProjectKey: $(SONARCLOUD_PROJECT_KEY)
# cliProjectName: $(SONARCLOUD_PROJECT_NAME)
# cliSources: $(Build.Repository.LocalPath)
extraProperties: |
sonar.javascript.file.suffixes=.js,.jsx
sonar.typescript.file.suffixes=.ts,.tsx
sonar.sources=.
sonar.exclusions=src/__tests__/**
sonar.tests=src/__tests__
sonar.test.inclusions=src/__tests__/**/*.test.tsx
sonar.testExecutionReportPaths=test-report.xml
sonar.sourceEncoding=UTF-8
sonar.verbose=true
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.typescript.tsconfigPath=tsconfig.json
sonar.eslint.reportPaths=eslint-report.json

- script: yarn test
displayName: 'Unit tests execution'

- script: yarn lint
displayName: 'Lint execution'

- task: SonarCloudAnalyze@1

- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
displayName: 'Publish SonarCloud results on build summary'

Loading