Skip to content

Commit 2e91db5

Browse files
mjcheethamdscho
authored andcommitted
azure-pipelines: add stub release pipeline for Azure (#886)
Add a stub pipeline for releases using Azure Pipelines. The pipeline runs on Microsoft internal images/runners across: * Windows x64 * Windows ARM64 * macOS * Ubuntu x64 * Ubuntu ARM64 At the start of a run there is a prerequisite stage and pre-build validation. Today this does nothing, and should be updated to: * validate the current commit is tagged (annotated), and * capture the Git version, tag name and SHA. Artifacts are uploaded from the build stage, and downloaded into the release stage later for uploading to a draft GitHub release. ESRP signing to be added later.
2 parents 8e6b7fb + a9c6288 commit 2e91db5

1 file changed

Lines changed: 259 additions & 0 deletions

File tree

.azure-pipelines/release.yml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
name: $(Date:yyyyMMdd)$(Rev:.r)
2+
trigger: none
3+
pr: none
4+
5+
resources:
6+
repositories:
7+
- repository: 1ESPipelines
8+
type: git
9+
name: 1ESPipelineTemplates/1ESPipelineTemplates
10+
ref: refs/tags/release
11+
12+
parameters:
13+
- name: 'github'
14+
type: boolean
15+
default: false # TODO: change default to true after testing
16+
displayName: 'Enable GitHub release publishing'
17+
18+
#
19+
# 1ES Pipeline Templates do not allow using a matrix strategy so we create
20+
# a YAML object parameter with and foreach to create jobs for each entry.
21+
# Each OS has its own matrix object since their build steps differ.
22+
#
23+
- name: windows_matrix
24+
type: object
25+
default:
26+
- id: windows_x64
27+
jobName: 'Windows (x64)'
28+
pool: GitClientPME-1ESHostedPool-intel-pc
29+
image: win-x86_64-ado1es
30+
os: windows
31+
toolchain: x86_64
32+
mingwprefix: mingw64
33+
34+
- id: windows_arm64
35+
jobName: 'Windows (ARM64)'
36+
pool: GitClientPME-1ESHostedPool-arm64-pc
37+
image: win-arm64-ado1es
38+
os: windows
39+
toolchain: clang-aarch64
40+
mingwprefix: clangarm64
41+
42+
# No matrix for macOS as we build both x64 and ARM64 in the same job
43+
# and produce a universal binary.
44+
45+
- name: linux_matrix
46+
type: object
47+
default:
48+
- id: linux_x64
49+
jobName: 'Linux (x64)'
50+
pool: GitClientPME-1ESHostedPool-intel-pc
51+
image: ubuntu-x86_64-ado1es
52+
os: linux
53+
cc_arch: x86_64
54+
deb_arch: amd64
55+
56+
- id: linux_arm64
57+
jobName: 'Linux (ARM64)'
58+
pool: GitClientPME-1ESHostedPool-arm64-pc
59+
image: ubuntu-arm64-ado1es
60+
os: linux
61+
cc_arch: aarch64
62+
deb_arch: arm64
63+
64+
variables:
65+
- name: 'githubConnectionName'
66+
value: 'GitHub-MicrosoftGit'
67+
68+
extends:
69+
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelines
70+
parameters:
71+
sdl:
72+
# SDL source analysis tasks only run on Windows images
73+
sourceAnalysisPool:
74+
name: GitClientPME-1ESHostedPool-intel-pc
75+
image: win-x86_64-ado1es
76+
os: windows
77+
stages:
78+
- stage: prereqs
79+
displayName: 'Prerequisites'
80+
jobs:
81+
- job: prebuild
82+
displayName: 'Pre-build validation'
83+
pool:
84+
name: GitClientPME-1ESHostedPool-intel-pc
85+
image: ubuntu-x86_64-ado1es
86+
os: linux
87+
steps:
88+
- task: Bash@3
89+
displayName: 'Resolve version and tag information'
90+
name: info
91+
inputs:
92+
targetType: inline
93+
script: |
94+
# TODO: determine git_version, tag_name, and tag_sha
95+
# TODO: error if the current commit is not an annotated tag
96+
git_version=TODO_GITVER
97+
tag_name=TODO_TAGNAME
98+
tag_sha=TODO_TAGSHA
99+
echo "##vso[task.setvariable variable=git_version;isOutput=true;isReadOnly=true]$git_version"
100+
echo "##vso[task.setvariable variable=tag_name;isOutput=true;isReadOnly=true]$tag_name"
101+
echo "##vso[task.setvariable variable=tag_sha;isOutput=true;isReadOnly=true]$tag_sha"
102+
103+
- stage: build
104+
displayName: 'Build'
105+
dependsOn: [prereqs]
106+
jobs:
107+
#
108+
# Windows build jobs
109+
#
110+
- ${{ each dim in parameters.windows_matrix }}:
111+
- job: ${{ dim.id }}
112+
displayName: ${{ dim.jobName }}
113+
pool:
114+
name: ${{ dim.pool }}
115+
image: ${{ dim.image }}
116+
os: ${{ dim.os }}
117+
variables:
118+
tag_name: $[stageDependencies.prereqs.prebuild.outputs['info.tag_name']]
119+
tag_sha: $[stageDependencies.prereqs.prebuild.outputs['info.tag_sha']]
120+
git_version: $[stageDependencies.prereqs.prebuild.outputs['info.git_version']]
121+
toolchain: ${{ dim.toolchain }}
122+
mingwprefix: ${{ dim.mingwprefix }}
123+
templateContext:
124+
outputs:
125+
- output: pipelineArtifact
126+
targetPath: '$(Build.ArtifactStagingDirectory)/_final'
127+
artifactName: '${{ dim.id }}'
128+
steps:
129+
- checkout: self
130+
# TODO: add tasks to set up Git for Windows SDK
131+
# TODO: add tasks to build Git and installers
132+
- script: |
133+
echo $(mingwprefix)
134+
echo $(toolchain)
135+
displayName: 'Dummy build'
136+
# TODO: put final artifacts under $(Build.ArtifactStagingDirectory)/_final
137+
- script: |
138+
echo "TODO" > $(Build.ArtifactStagingDirectory)/_final/placeholder.txt
139+
140+
#
141+
# macOS build job (universal)
142+
#
143+
- job: macos_universal
144+
displayName: 'macOS (x64 + ARM64)'
145+
pool:
146+
name: 'Azure Pipelines'
147+
image: macOS-latest
148+
os: macos
149+
variables:
150+
tag_name: $[stageDependencies.prereqs.prebuild.outputs['info.tag_name']]
151+
tag_sha: $[stageDependencies.prereqs.prebuild.outputs['info.tag_sha']]
152+
git_version: $[stageDependencies.prereqs.prebuild.outputs['info.git_version']]
153+
templateContext:
154+
outputs:
155+
- output: pipelineArtifact
156+
targetPath: '$(Build.ArtifactStagingDirectory)/_final'
157+
artifactName: 'macos_universal'
158+
steps:
159+
- checkout: self
160+
# TODO: add tasks to set up build environment
161+
# TODO: add tasks to build Git and installers
162+
- script: |
163+
echo "Hello, Mac!"
164+
displayName: 'Dummy build'
165+
# TODO: put final artifacts under $(Build.ArtifactStagingDirectory)/_final
166+
- script: |
167+
echo "TODO" > $(Build.ArtifactStagingDirectory)/_final/placeholder.txt
168+
169+
#
170+
# Linux build jobs
171+
#
172+
- ${{ each dim in parameters.linux_matrix }}:
173+
- job: ${{ dim.id }}
174+
displayName: ${{ dim.jobName }}
175+
pool:
176+
name: ${{ dim.pool }}
177+
image: ${{ dim.image }}
178+
os: ${{ dim.os }}
179+
variables:
180+
tag_name: $[stageDependencies.prereqs.prebuild.outputs['info.tag_name']]
181+
tag_sha: $[stageDependencies.prereqs.prebuild.outputs['info.tag_sha']]
182+
git_version: $[stageDependencies.prereqs.prebuild.outputs['info.git_version']]
183+
cc_arch: ${{ dim.cc_arch }}
184+
deb_arch: ${{ dim.deb_arch }}
185+
templateContext:
186+
outputs:
187+
- output: pipelineArtifact
188+
targetPath: '$(Build.ArtifactStagingDirectory)/_final'
189+
artifactName: '${{ dim.id }}'
190+
steps:
191+
- checkout: self
192+
# TODO: add tasks to set up build environment
193+
# TODO: add tasks to build Git and installers
194+
- script: |
195+
echo $(cc_arch)
196+
echo $(deb_arch)
197+
displayName: 'Dummy build'
198+
# TODO: put final artifacts under $(Build.ArtifactStagingDirectory)/_final
199+
- script: |
200+
echo "TODO" > $(Build.ArtifactStagingDirectory)/_final/placeholder.txt
201+
202+
- stage: release
203+
displayName: 'Release'
204+
dependsOn: [prereqs, build]
205+
jobs:
206+
- job: github
207+
displayName: 'Publish GitHub release'
208+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
209+
pool:
210+
name: GitClientPME-1ESHostedPool-intel-pc
211+
image: ubuntu-x86_64-ado1es
212+
os: linux
213+
variables:
214+
tag_name: $[stageDependencies.prereqs.prebuild.outputs['info.tag_name']]
215+
tag_sha: $[stageDependencies.prereqs.prebuild.outputs['info.tag_sha']]
216+
git_version: $[stageDependencies.prereqs.prebuild.outputs['info.git_version']]
217+
templateContext:
218+
type: releaseJob
219+
isProduction: true
220+
inputs:
221+
- input: pipelineArtifact
222+
artifactName: 'windows_x64'
223+
targetPath: $(Pipeline.Workspace)/assets/windows_x64
224+
- input: pipelineArtifact
225+
artifactName: 'windows_arm64'
226+
targetPath: $(Pipeline.Workspace)/assets/windows_arm64
227+
- input: pipelineArtifact
228+
artifactName: 'macos_universal'
229+
targetPath: $(Pipeline.Workspace)/assets/macos_universal
230+
- input: pipelineArtifact
231+
artifactName: 'linux_x64'
232+
targetPath: $(Pipeline.Workspace)/assets/linux_x64
233+
- input: pipelineArtifact
234+
artifactName: 'linux_arm64'
235+
targetPath: $(Pipeline.Workspace)/assets/linux_arm64
236+
steps:
237+
- task: GitHubRelease@1
238+
displayName: 'Create Draft GitHub Release'
239+
inputs:
240+
gitHubConnection: $(githubConnectionName)
241+
repositoryName: microsoft/git
242+
tag: '$(tag_name)'
243+
tagSource: userSpecifiedTag
244+
target: '$(tag_sha)'
245+
title: '$(tag_name)'
246+
isDraft: true
247+
addChangeLog: true
248+
assets: |
249+
$(Pipeline.Workspace)/assets/windows_x64/*.exe
250+
$(Pipeline.Workspace)/assets/windows_x64/*.zip
251+
$(Pipeline.Workspace)/assets/windows_arm64/*.exe
252+
$(Pipeline.Workspace)/assets/windows_arm64/*.zip
253+
$(Pipeline.Workspace)/assets/macos_universal/*.pkg
254+
$(Pipeline.Workspace)/assets/macos_universal/*.dmg
255+
$(Pipeline.Workspace)/assets/macos_universal/*.tar.gz
256+
$(Pipeline.Workspace)/assets/linux_x64/*.deb
257+
$(Pipeline.Workspace)/assets/linux_x64/*.tar.gz
258+
$(Pipeline.Workspace)/assets/linux_arm64/*.deb
259+
$(Pipeline.Workspace)/assets/linux_arm64/*.tar.gz

0 commit comments

Comments
 (0)