Skip to content

Commit dfacbbb

Browse files
Courtesy Push Pipeline Improvement - Part#1 | Eliminate Job-4 build_all_tasks_for_deployments (#21417)
* update Job1 with Job4 functionalities * job4 Removal * Move GitHub Release to job $ * Modify Fixes * Udpate#1 Review Comments * Minor fixes * Fix hotfix parameter passing * Modify layout-version.txt handling * Removal of unused parameters * AB#2329703 Link Work-Item
1 parent 3395d6d commit dfacbbb

File tree

11 files changed

+144
-186
lines changed

11 files changed

+144
-186
lines changed

.azure-pipelines/.vsts.release.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ variables:
8585
value: 'true'
8686
${{ else }}:
8787
value: 'false'
88+
- name: tasksBuildArtifact
89+
value: 'allTasks'
8890

8991
extends:
9092
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
@@ -134,7 +136,7 @@ extends:
134136
ne(variables['numTasks'], 0)
135137
)
136138
PathtoPublish: _package/tasks.zip
137-
ArtifactName: package
139+
ArtifactName: $(tasksBuildArtifact)
138140
sbomBuildDropPath: $(Build.SourcesDirectory)/_package
139141
steps:
140142
- template: /ci/build-all-steps.yml@self
@@ -199,30 +201,26 @@ extends:
199201
steps:
200202
- checkout: self
201203
- template: /ci/courtesy-push.yml@self
202-
203-
- job: build_all_tasks_for_deployments
204-
displayName: Build all tasks for deployments (Windows)
205-
dependsOn:
206-
- courtesy_push
207-
- build_all_windows
208-
condition: succeeded()
209-
timeoutInMinutes: 360
204+
205+
# GitHub Release
206+
- job: github_release
207+
displayName: Create GitHub Release
208+
timeoutInMinutes: 60
210209
pool:
211210
name: 1ES-ABTT-Shared-Pool
212211
image: abtt-windows-2022
213212
os: windows
213+
dependsOn:
214+
- courtesy_push
214215
variables:
215-
task_pattern: $[dependencies.build_all_windows.outputs['getTaskPattern.task_pattern']]
216+
courtesy_push_pr_id: $[dependencies.courtesy_push.outputs['createCourtesyPushPR.PR_ID']]
217+
courtesy_push_pr_link: $[dependencies.courtesy_push.outputs['createCourtesyPushPR.PR_LINK']]
218+
condition: |
219+
and(
220+
succeeded(),
221+
in(variables['build.reason'], 'Schedule', 'Manual')
222+
)
216223
templateContext:
217-
outputs:
218-
- output: buildArtifacts
219-
displayName: 'Publish package artifact'
220-
PathtoPublish: _package/tasks.zip
221-
sbomBuildDropPath: $(Build.SourcesDirectory)/_package
222-
ArtifactName: allTasks
224+
outputs: []
223225
steps:
224-
- template: /ci/build-all-tasks.yml@self
225-
parameters:
226-
deploy_all_tasks: ${{ eq(parameters.task_deployment, 'Deploy all Tasks') }}
227-
useSemverBuildConfig: ${{ parameters.useSemverBuildConfig }}
228-
226+
- template: /ci/github-release.yml@self

ci/build-all-steps.yml

Lines changed: 25 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ steps:
1717
displayName: Start collect diagnostics
1818
condition: and(succeeded(), eq(variables.collect_diagnostics, 'true'))
1919

20+
# Use .NET SDK 8
21+
- task: UseDotNet@2
22+
displayName: 'Install .NET Core SDK 8.x'
23+
inputs:
24+
version: 8.x
25+
2026
# Use node 20, npm 9
2127
- task: NodeTool@0
2228
displayName: Use node 20
@@ -79,45 +85,6 @@ steps:
7985
- powershell: ./ci/set-sprint-variables.ps1
8086
displayName: Set currentSprint variables
8187

82-
- template: /ci/generate-branch-name.yml@self
83-
parameters:
84-
prefix: releases
85-
86-
- powershell: |
87-
$releaseBranch = "$(branchName)"
88-
$isDryRun = "$(isDryRun)"
89-
90-
# add config entry to avoid errors while pulling
91-
git config --global user.email "$(username)@microsoft.com"
92-
git config --global user.name "$(username)"
93-
94-
Write-Host 'Enabling verbose git tracing..'
95-
git config --global http.verbose true
96-
$env:GIT_TRACE = 1
97-
$env:GIT_CURL_VERBOSE = 1
98-
99-
# Pull commits from remote and push branch to git
100-
git checkout -b $releaseBranch
101-
if( $isDryRun -eq 'true' ) {
102-
Write-Host "DRY RUN: Skipping Git push operations to remote repository"
103-
}else{
104-
Write-Host "Trying to pull the remote branch.."
105-
git pull https://$(GitHubPAT)@github.com/microsoft/azure-pipelines-tasks $releaseBranch
106-
if (-not $?) {
107-
Write-Host "Failed to pull the remote branch. This is expected if the remote branch doesn't exist."
108-
}
109-
Write-Host "Trying to push to the remote branch.."
110-
git push https://$(GitHubPAT)@github.com/microsoft/azure-pipelines-tasks $releaseBranch
111-
}
112-
condition: |
113-
and(
114-
succeeded(),
115-
in(variables['build.reason'], 'Schedule', 'Manual'),
116-
eq(variables['COURTESY_PUSH'], 'true'),
117-
eq(variables['Build.SourceBranch'], 'refs/heads/master')
118-
)
119-
displayName: Push release branch
120-
12188
- script: node ./ci/check-downgrading.js --task "$(task_pattern_fordowngradingcheck)" --sprint $(currentSprint) --week $(currentSprintWeek)
12289
displayName: Check for downgrading tasks
12390
# remove SourceBranch condition after merging users/merlynop/node20merge-2 ; see https://github.com/microsoft/azure-pipelines-tasks/pull/20819
@@ -164,11 +131,27 @@ steps:
164131
ne(variables['numTasks'], 0)
165132
)
166133
134+
# Test
135+
- script: node make.js test
136+
displayName: Run tests
137+
condition: and(succeeded(), ne(variables['numTasks'], 0), ne(variables['tasksSkipTests'], 'true'))
138+
139+
- script: node make.js testLegacy --task "$(getTaskPattern.task_pattern)"
140+
displayName: Legacy tests with node 6
141+
condition: and(succeeded(), ne(variables['numTasks'], 0), ne(variables['tasksSkipTests'], 'true'))
142+
143+
# Publish code coverage result
144+
- task: PublishCodeCoverageResults@1
145+
displayName: Publish Code Coverage Results
146+
inputs:
147+
codeCoverageTool: Cobertura
148+
summaryFileLocation: $(System.DefaultWorkingDirectory)/_build/coverage/*coverage.xml
149+
167150
# Only on Windows:
168151
- ${{ if eq(parameters.os, 'Windows_NT') }}:
169152

170153
# Stage tasks individually into the package directory
171-
- script: node ./ci/stage-package.js false individually
154+
- script: node ./ci/stage-package.js true individually
172155
displayName: Stage tasks individually into the package directory
173156
condition: |
174157
and(
@@ -183,7 +166,7 @@ steps:
183166
layoutRoot: $(Build.SourcesDirectory)\_package\tasks-layout
184167

185168
# Stage all the tasks into a single zip for upload
186-
- script: node ./ci/stage-package.js false
169+
- script: node ./ci/stage-package.js
187170
displayName: Stage all the tasks into a single zip for upload
188171
condition: |
189172
and(
@@ -192,21 +175,6 @@ steps:
192175
ne(variables['numTasks'], 0)
193176
)
194177
195-
# Test
196-
- script: node make.js test
197-
displayName: Run tests
198-
condition: and(succeeded(), ne(variables['numTasks'], 0), ne(variables['tasksSkipTests'], 'true'))
199-
- script: node make.js testLegacy --task "$(getTaskPattern.task_pattern)"
200-
displayName: Legacy tests with node 6
201-
condition: and(succeeded(), ne(variables['numTasks'], 0), ne(variables['tasksSkipTests'], 'true'))
202-
203-
# Publish code coverage result
204-
- task: PublishCodeCoverageResults@1
205-
displayName: Publish Code Coverage Results
206-
inputs:
207-
codeCoverageTool: Cobertura
208-
summaryFileLocation: $(System.DefaultWorkingDirectory)/_build/coverage/*coverage.xml
209-
210178
# Only when building on Windows:
211179
- ${{ if eq(parameters.os, 'Windows_NT') }}:
212180

@@ -218,26 +186,4 @@ steps:
218186
always(),
219187
eq(variables.collect_diagnostics, 'true'),
220188
ne(variables['numTasks'], 0)
221-
)
222-
223-
- powershell: |
224-
$releaseBranch = "$(branchName)"
225-
$isDryRun = "$(isDryRun)"
226-
227-
if (($(currentSprintWeek) -eq 3) -or ($isDryRun -eq 'true')) {
228-
cd $(System.DefaultWorkingDirectory)/ci/ci-release-notes
229-
npm ci
230-
node release-notes.js --token $(GitHubPAT) --version $(currentSprint) --releaseBranch $releaseBranch --isDryRun $isDryRun
231-
} else {
232-
echo "Skipping since release notes generating on week 3"
233-
}
234-
condition: |
235-
and(
236-
succeeded(),
237-
in(variables['build.reason'], 'Schedule', 'Manual'),
238-
eq(variables['COURTESY_PUSH'], 'true'),
239-
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
240-
eq(${{ parameters.generateReleaseNotes }}, true)
241-
)
242-
continueOnError: true
243-
displayName: Create Release
189+
)

ci/build-all-tasks.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

ci/courtesy-push.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ steps:
2727
- template: /ci/get-AzDo-pat.yml@self
2828

2929
- script: node $(Build.SourcesDirectory)/ci/courtesy-push/courtesy-push.js $(Build.SourcesDirectory)/IndividualNugetPackagesDownloaded/IndividualNugetPackages/unified_deps.xml
30+
name: createCourtesyPushPR
3031
displayName: Update unified deps and create branch
3132
env:
3233
TOKEN: $(AzDo_PAT)
3334
BRANCH_NAME: $(branchName)
3435
DRYRUN: $(isDryRun)
3536
USERNAME: $(username)
36-
37-
- powershell: $(Build.SourcesDirectory)/ci/courtesy-push/send-notification.ps1
38-
displayName: Send MS Teams notification
39-
condition: or(eq(variables['build.reason'], 'Schedule'), eq(variables['build.reason'], 'Manual'))
40-
env:
41-
TEAMS_WEBHOOK: $(MSTeamsUri)
37+

ci/courtesy-push/courtesy-push.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ Generated: ${new Date().toISOString()}`
173173
console.log(`Link to the PR: ${prLink}`);
174174

175175
// Set Azure Pipeline variables
176-
console.log(`##vso[task.setvariable variable=PR_ID]${PR.pullRequestId}`);
177-
console.log(`##vso[task.setvariable variable=PR_LINK]${prLink}`);
176+
console.log(`##vso[task.setvariable variable=PR_ID;isOutput=true]${PR.pullRequestId}`);
177+
console.log(`##vso[task.setvariable variable=PR_LINK;isOutput=true]${prLink}`);
178178

179179
return {
180180
prId: PR.pullRequestId,
@@ -194,8 +194,8 @@ Generated: ${new Date().toISOString()}`
194194
const dummyPrId = `DRYRUN-${timestamp}`;
195195
const dummyPrLink = `https://${orgUrl}/${project}/_git/${repo}/pullrequest/DRYRUN-${timestamp}`;
196196

197-
console.log(`##vso[task.setvariable variable=PR_ID]${dummyPrId}`);
198-
console.log(`##vso[task.setvariable variable=PR_LINK]${dummyPrLink}`);
197+
console.log(`##vso[task.setvariable variable=PR_ID;isOutput=true]${dummyPrId}`);
198+
console.log(`##vso[task.setvariable variable=PR_LINK;isOutput=true]${dummyPrLink}`);
199199

200200
console.log(`DRYRUN: Generated dummy PR_ID = ${dummyPrId}`);
201201
console.log(`DRYRUN: Generated dummy PR_LINK = ${dummyPrLink}`);

ci/download-built.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ $ErrorActionPreference = 'Stop'
33
Add-Type -Assembly 'System.IO.Compression.FileSystem'
44
try {
55
# Download the package
6-
$downloadUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build/builds/$env:BUILD_BUILDID/artifacts?artifactName=package&%24format=zip&api-version=3"
6+
$tasksBuildArtifact = $env:TASKS_BUILD_ARTIFACT
7+
$downloadUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build/builds/$env:BUILD_BUILDID/artifacts?artifactName=$tasksBuildArtifact&%24format=zip&api-version=3"
78
$downloadTarget = "$env:SYSTEM_ARTIFACTSDIRECTORY\package.zip"
89
Write-Host "Downloading: '$downloadUrl' to target '$downloadTarget'"
910
$webClient = New-Object System.Net.WebClient

0 commit comments

Comments
 (0)