-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy-pipelines.yml
121 lines (109 loc) · 3.94 KB
/
deploy-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Azure DevOps pipeline to release a new version and deploy to production.
variables:
HEALTHCHECK_PATH: '/api/v1/info'
# Only manual activations are intended
trigger: none
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. Depending on the os_type of the resource 'windows' or
# 'ubuntu-latest' may be inserted here
pool:
vmImage: 'ubuntu-latest'
resources:
repositories:
- repository: pagopaCommons
type: github
name: pagopa/azure-pipeline-templates
ref: refs/tags/v18
endpoint: 'io-azure-devops-github-ro'
stages:
# Prepare Artifact
- stage: Prepare_artifact
jobs:
- job: 'prepare_artifact'
steps:
# Build application
- 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.
# The branch/tag name is calculated from the source branch
# ex: Build.SourceBranch=refs/heads/master --> master
# ex: Build.SourceBranch=refs/tags/v1.2.3-RELEASE --> v1.2.3-RELEASE
gitReference: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/tags/', ''), 'refs/heads/', '') }}
- script: |
yarn predeploy
displayName: 'Build'
# Install functions extensions
- task: DotNetCoreCLI@2
inputs:
command: "build"
arguments: "-o bin"
# Copy application to
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
TargetFolder: '$(System.DefaultWorkingDirectory)/bundle'
Contents: |
**/*
!.git/**/*
!**/*.js.map
!**/*.ts
!.vscode/**/*
!.devops/**/*
!.prettierrc
!.gitignore
!README.md
!jest.config.js
!local.settings.json
!test
!tsconfig.json
!tslint.json
!yarn.lock
!Dangerfile.js
!CODEOWNERS
!__*/**/*
displayName: 'Copy deploy files'
- publish: $(System.DefaultWorkingDirectory)/bundle
artifact: Bundle
- stage: Deploy_to_Production_Slot
dependsOn:
- Prepare_artifact
jobs:
- job: 'do_deploy'
steps:
- checkout: none
- download: current
artifact: Bundle
- task: AzureFunctionApp@1
inputs:
azureSubscription: '$(PRODUCTION_AZURE_SUBSCRIPTION)'
resourceGroupName: "$(PRODUCTION_RESOURCE_GROUP_NAME)"
appType: 'functionApp'
appName: "$(PRODUCTION_APP_NAME)"
package: '$(Pipeline.Workspace)/Bundle'
deploymentMethod: 'auto'
deployToSlotOrASE: true
slotName: 'production'
displayName: Deploy code
- stage: Deploy_to_DryRun_Slot
dependsOn:
- Prepare_artifact
jobs:
- job: 'do_deploy'
steps:
- checkout: none
- download: current
artifact: Bundle
- task: AzureFunctionApp@1
inputs:
azureSubscription: '$(PRODUCTION_AZURE_SUBSCRIPTION)'
resourceGroupName: "$(PRODUCTION_RESOURCE_GROUP_NAME)"
appType: 'functionApp'
appName: "$(PRODUCTION_APP_NAME)"
package: '$(Pipeline.Workspace)/Bundle'
deploymentMethod: 'auto'
deployToSlotOrASE: true
slotName: 'dryrun'
displayName: Deploy code