Skip to content

Commit 43ff155

Browse files
authored
[PatchRelease] Create a new pipeline to prepare patch release (#41766)
1 parent fbd7bf5 commit 43ff155

File tree

2 files changed

+56
-11
lines changed

2 files changed

+56
-11
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This script is used to prepare the patch release by generating patches for automatic releases.
2+
# It should be triggered manually by the release driver. Release driver should ensure that the CI pipeline is green
3+
# before manually trigger the patch release pipeline, 'java - patch-release'.
4+
# The release driver should also ensure that the patches are generated successfully and the PR is created successfully.
5+
#
6+
# What this script does:
7+
# - Checks out a new release branch, 'release/patch/$currentDate'
8+
# - Runs the script to generate patches for automatic releases
9+
# - Create a PR with the patches prepared
10+
11+
trigger: none
12+
pr: none
13+
14+
parameters:
15+
- name: TestPipeline
16+
type: boolean
17+
default: false
18+
19+
stages:
20+
- stage: PreparePatchRelease
21+
displayName: Prepare Patch Release
22+
jobs:
23+
- job: PreparePatchRelease
24+
displayName: 'Prepare Patch Release'
25+
timeoutInMinutes: 30
26+
pool:
27+
name: azsdk-pool-mms-ubuntu-2004-general
28+
image: azsdk-pool-mms-ubuntu-2004-1espt
29+
os: linux
30+
steps:
31+
# Checkout a new release branch
32+
- pwsh: |
33+
$currentDate = Get-Date -Format "yyyyMMdd"
34+
$branchName = "release/patch/$currentDate"
35+
Write-Host "git checkout main"
36+
git checkout main
37+
Write-Host "git checkout -b $branchName"
38+
git checkout -b $branchName
39+
workingDirectory: $(Build.SourcesDirectory)
40+
displayName: 'Create release branch'
41+
# Run the script to generate patches for automatic releases
42+
- task: PowerShell@2
43+
displayName: 'Run Generate-Patches-For-Automatic-Releases script'
44+
inputs:
45+
pwsh: true
46+
filePath: eng/scripts/Generate-Patches-For-Automatic-Releases.ps1
47+
arguments: >
48+
-SourcesDirectory .
49+
-PackagesYmlPath eng/pipelines/patch-release.yml
50+
# Create a PR with the patches prepared
51+
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
52+
parameters:
53+
PRBranchName: prepare-patch-release-$(Build.BuildId)
54+
CommitMsg: "Patch release preparation"
55+
PRTitle: "Prepare patch release"
56+
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'

eng/scripts/Generate-Patches-For-Automatic-Releases.ps1

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@ try {
6565

6666
# Update POMs for all libraries with dependencies on the libraries to patch. Also, update the READMEs of the latter.
6767
python "${PSScriptRoot}/../versioning/update_versions.py" --update-type library --build-type client --ll $libraryList
68-
69-
Write-Host "git add -A"
70-
git add -A
71-
72-
$commitMessage = "Updated dependencies in libraries and READMEs via version_client.txt"
73-
74-
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"[email protected]`" commit -m $commitMessage"
75-
git -c user.name="azure-sdk" -c user.email="[email protected]" commit -m $commitMessage
76-
77-
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"[email protected]`" push $remoteName $branchName"
78-
git -c user.name="azure-sdk" -c user.email="[email protected]" push $remoteName $branchName
7968
} catch {
8069
LogError "Failed to update dependencies in libraries and READMEs via version_client.txt"
8170
exit 1

0 commit comments

Comments
 (0)