This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
123 lines (108 loc) · 3.17 KB
/
azure-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
122
123
trigger:
- master
pr:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
- name: buildConfiguration
value: 'Release'
- name: dotnetVersion
value: '5.0.x'
- name: MSBUILDSINGLELOADCONTEXT
value: '1'
- name: BROWSER
value: chrome
- name: DB__SERVERURL
value: $(SERVERURL)
- name: DB__DATABASENAME
value: bc-development-bapi
- name: AZUREBLOBSTORAGE__CONTAINERNAME
value: buyingcatalogue-development-helm-documents
- group: dev-secrets
steps:
- task: UseGitVersion@5
name: gitversion
displayName: Work out version
inputs:
versionSpec: '5.x'
- task: UseDotNet@2
displayName: 'Use DotNet $(dotnetVersion)'
inputs:
version: $(dotnetVersion)
includePreviewVersions: false
- bash: |
echo "##vso[task.setvariable variable=PBHOSTURL]$(echo "${PBURL##*://}")"
displayName: Set up Host URL
- task: AzureCLI@2
name: checkURL
displayName: Check URL is reachable
inputs:
azureSubscription: 'NHSAPP-BuyingCatalogue (Non-Prod)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
appgwPip=$(az network public-ip show --name gpitfutures-development-pip --resource-group gpitfutures-development-rg-appgw --query ipAddress -o tsv)
echo "DEBUG: $appgwPip $PBHOSTURL"
echo "$appgwPip $PBHOSTURL" | sudo tee -a /etc/hosts
curl -k -i $(PBURL) --fail --connect-timeout 30
- bash: |
./selenium-grid-setup.sh
if [ $? -ne 0 ]; then exit 1; fi
displayName: Selenium Grid Setup
- task: DotNetCoreCLI@2
displayName: 'Run dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Run dotnet build'
inputs:
command: build
projects: '**/*.csproj'
arguments: "--no-restore"
- task: DotNetCoreCLI@2
displayName: 'Run All Acceptance Tests'
inputs:
command: test
projects: '**/*.csproj'
arguments: '-v n --no-build'
env:
DB__PASSWORD: $(gpitfuturesdevdbpassword)
- task: Docker@2
condition: and(always(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Build and push docker image
inputs:
containerRegistry: 'gpitfuturesdevacr'
repository: 'nhsd/buying-catalogue/mp-ac-tests'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: "$(GitVersion.SemVer)"
addPipelineData: false
- task: HelmInstaller@1
displayName: 'Install helm'
condition: and(always(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
helmVersionToInstall: 'latest'
- bash: |
cd charts
helm package \
--version $(GitVersion.SemVer) \
--app-version $(GitVersion.SemVer) \
mp-ac-tests
failOnStderr: true
condition: and(always(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: helmPackage
displayName: 'Helm package'
- bash: |
cd charts
chartPackage=$(ls mp-ac-tests-*.tgz)
az acr helm push --force \
-n "gpitfuturesdevacr" \
-u "gpitfuturesdevacr" \
-p $(gpitfuturesdevacr-pass) \
$chartPackage
failOnStderr: false
condition: and(always(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: helmPush
displayName: 'Push helm chart to acr'