-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathazure-pipelines.tenant.cd.yaml
More file actions
104 lines (93 loc) · 2.46 KB
/
Copy pathazure-pipelines.tenant.cd.yaml
File metadata and controls
104 lines (93 loc) · 2.46 KB
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
resources:
pipelines:
- pipeline: pipeline-trigger
source: Build_And_Push_All
trigger: true
trigger:
branches:
include:
- dev
- release/*
- linkathon/*
paths:
include:
- DotNet/Tenant/*
- DotNet/DMRP/*
- DotNet/Shared/*
exclude:
- '*'
pr: none
pool:
vmImage: 'ubuntu-latest'
variables:
- group: link-cloud-variables
- name: project
value: 'DotNet/Tenant/Tenant.csproj'
- name: testProject
value: 'DotNet/TenantUnitTests/TenantUnitTests.csproj'
- name: registry-repo-Name
value: 'link-tenant'
- name: dockerPath
value: '**/DotNet/Tenant/Dockerfile'
- name: serviceName
value: 'Tenant'
- name: projectDir
value: 'DotNet/Tenant'
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '$(project)'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
GIT_COMMIT=$(git rev-parse --short HEAD)
echo "GIT_COMMIT: ${GIT_COMMIT}"
echo "##vso[task.setvariable variable=GIT_COMMIT]${GIT_COMMIT}"
- task: PythonScript@0
displayName: "Inject Service Info"
inputs:
scriptSource: 'filePath'
scriptPath: '$(Build.SourcesDirectory)/Scripts/set_service_info.py'
workingDirectory: '$(Build.SourcesDirectory)'
arguments: './ "$(projectDir)" "$(GIT_COMMIT)" "$(Build.BuildNumber)"'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '$(project)'
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: $(testProject)'
displayName: 'Run Tests'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
if ("$(Build.SourceBranch)" -like "*release/*") {
$myTag1 = "release-$(Build.SourceBranchName)-$(GIT_COMMIT)"
}
else {
$myTag1 = "$(Build.SourceBranchName)-$(GIT_COMMIT)"
}
Write-Host "##vso[task.setvariable variable=MyTag]$myTag1"
Write-Host "Set MyTag to: $myTag1"
- task: Docker@2
displayName: "Build & Push Tenant Docker Image"
condition: always()
inputs:
containerRegistry: $(containerRegistry) # Variable Group
repository: $(registry-repo-name)
command: 'buildAndPush'
Dockerfile: $(dockerPath)
tags: |
latest
$(MyTag)
buildContext: '$(Build.Repository.LocalPath)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'manifest'