Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
hotfix upgrade pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
AleDore committed Aug 31, 2021
1 parent 33f3d45 commit 4e67405
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 75 deletions.
30 changes: 0 additions & 30 deletions .devops/azure-templates/setup-project.yml

This file was deleted.

41 changes: 20 additions & 21 deletions .devops/code-review-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
# - DANGER_GITHUB_API_TOKEN
#

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

# 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
Expand All @@ -19,68 +15,71 @@ trigger: none
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
pool:
# As we deploy on Windows machines, we use Windows to build
# As we deploy on Wondows machines, we use Windows to build
vmImage: 'windows-2019'
steps:
- template: azure-templates/setup-project.yml
- script: yarn build
- template: templates/node-job-setup/template.yaml@pagopaCommons
- script: |
yarn build
displayName: 'Build'
- stage: Static_analysis
dependsOn: []
jobs:

- job: lint
steps:
- template: azure-templates/setup-project.yml
- template: templates/node-job-setup/template.yaml@pagopaCommons
- script: |
yarn lint
displayName: 'Lint'
- job: validate_api_specification
- job: lint_api
steps:
- template: templates/node-job-setup/template.yaml@pagopaCommons
- script: |
npx oval validate -p openapi/index.yaml
displayName: 'Validate API specification'
yarn lint-api
displayName: 'Lint API'
- job: danger
condition:
and(
succeeded(),
ne(variables['DANGER_GITHUB_API_TOKEN'], 'skip')
)
steps:
- template: azure-templates/setup-project.yml
- 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: azure-templates/setup-project.yml
- template: templates/node-job-setup/template.yaml@pagopaCommons

- script: |
yarn generate
displayName: 'Generate definitions'
- script: |
yarn test:coverage
displayName: 'Unit tests exec'
- bash: |
bash <(curl -s https://codecov.io/bash)
displayName: 'Code coverage'
displayName: 'Code coverage'
35 changes: 11 additions & 24 deletions .devops/deploy-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Azure DevOps pipeline to release a new version and deploy to production.

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

parameters:
- name: 'RELEASE_SEMVER'
displayName: 'When packing a release, define the version bump to apply'
Expand All @@ -20,24 +16,18 @@ pr: none

# This pipeline has been implemented to be run on hosted agent pools based both
# on 'windows' and 'ubuntu' virtual machine images and using the scripts defined
# in the package.json file. Since we are degitploying on Azure functions on Windows
# in the package.json file. Since we are deploying on Azure functions on Windows
# runtime, the pipeline is currently configured to use a Windows hosted image for
# the build and deploy.
pool:
vmImage: 'windows-2019'

resources:
repositories:
- repository: pagopaCommonsLegacy
type: github
name: pagopa/azure-pipeline-templates
ref: refs/tags/v4
endpoint: 'pagopa'

repositories:
- repository: pagopaCommons
type: github
name: pagopa/azure-pipeline-templates
ref: refs/tags/v13
ref: refs/tags/v15
endpoint: 'pagopa'

stages:
Expand All @@ -64,22 +54,21 @@ stages:
- job: make_release
steps:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
- template: templates/node-github-release/template.yaml@pagopaCommonsLegacy
- template: templates/node-job-setup/template.yaml@pagopaCommons
parameters:
persistCredentials: true
- template: templates/node-github-release/template.yaml@pagopaCommons
parameters:
semver: '${{ parameters.RELEASE_SEMVER }}'
gitEmail: $(GIT_EMAIL)
gitUsername: $(GIT_USERNAME)
gitHubConnection: $(GITHUB_CONNECTION)
nodeVersion: $(NODE_VERSION)
pkg_cache_version_id: $(CACHE_VERSION_ID)
pkg_cache_folder: $(YARN_CACHE_FOLDER)

- ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/master') }}:
- script: |
echo "We assume this reference to be a valid release: $(Build.SourceBranch). Therefore, there is no need to bundle a new release."
displayName: 'Skip release bundle'
# Prepare Artifact
- stage: Deploy_staging
dependsOn:
Expand All @@ -88,7 +77,7 @@ stages:
- job: 'prepare_artifact_and_deploy'
steps:
# Build application
- template: azure-templates/setup-project.yml
- template: templates/node-job-setup/template.yaml@pagopaCommons
parameters:
# On the assumption that this stage is executed only when Relase stage is,
# with this parameter we set the reference the deploy script must pull changes from.
Expand All @@ -99,7 +88,6 @@ stages:
- script: |
yarn predeploy
displayName: 'Build'
# Install functions extensions
- task: DotNetCoreCLI@2
inputs:
Expand Down Expand Up @@ -146,15 +134,15 @@ stages:
jobs:
- job: 'do_healthcheck'
steps:
- template: templates/rest-healthcheck/template.yaml@pagopaCommonsLegacy
- template: templates/rest-healthcheck/template.yaml@pagopaCommons
parameters:
azureSubscription: '$(PRODUCTION_AZURE_SUBSCRIPTION)'
appName: '$(PRODUCTION_APP_NAME)'
endpoint: 'https://$(PRODUCTION_APP_NAME)-staging.azurewebsites.net/api/v1/cgn/info'
endpointType: 'private'
containerInstanceResourceGroup: 'io-p-rg-common'
containerInstanceVNet: 'io-p-vnet-common'
containerInstanceSubnet: 'azure-devops'
containerInstanceSubnet: 'azure-devops'

# Promote the staging instance to production
- stage: Deploy_production
Expand All @@ -173,7 +161,7 @@ stages:
swapWithProduction: true
displayName: Swap with production slot


# Publish client SDK to NPM
- stage: PublishClientSDKtoNPM
dependsOn: Release
Expand All @@ -186,4 +174,3 @@ stages:
- template: templates/client-sdk-publish/template.yaml@pagopaCommons
parameters:
openapiSpecPath: 'openapi/index.yaml'
generatorPackageName: italia-utils

0 comments on commit 4e67405

Please sign in to comment.