Skip to content

Commit

Permalink
[PatchRelease] Create a new pipeline to prepare patch release (#41766)
Browse files Browse the repository at this point in the history
  • Loading branch information
mssfang authored Sep 17, 2024
1 parent fbd7bf5 commit 43ff155
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 11 deletions.
56 changes: 56 additions & 0 deletions eng/pipelines/patch-release-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This script is used to prepare the patch release by generating patches for automatic releases.
# It should be triggered manually by the release driver. Release driver should ensure that the CI pipeline is green
# before manually trigger the patch release pipeline, 'java - patch-release'.
# The release driver should also ensure that the patches are generated successfully and the PR is created successfully.
#
# What this script does:
# - Checks out a new release branch, 'release/patch/$currentDate'
# - Runs the script to generate patches for automatic releases
# - Create a PR with the patches prepared

trigger: none
pr: none

parameters:
- name: TestPipeline
type: boolean
default: false

stages:
- stage: PreparePatchRelease
displayName: Prepare Patch Release
jobs:
- job: PreparePatchRelease
displayName: 'Prepare Patch Release'
timeoutInMinutes: 30
pool:
name: azsdk-pool-mms-ubuntu-2004-general
image: azsdk-pool-mms-ubuntu-2004-1espt
os: linux
steps:
# Checkout a new release branch
- pwsh: |
$currentDate = Get-Date -Format "yyyyMMdd"
$branchName = "release/patch/$currentDate"
Write-Host "git checkout main"
git checkout main
Write-Host "git checkout -b $branchName"
git checkout -b $branchName
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Create release branch'
# Run the script to generate patches for automatic releases
- task: PowerShell@2
displayName: 'Run Generate-Patches-For-Automatic-Releases script'
inputs:
pwsh: true
filePath: eng/scripts/Generate-Patches-For-Automatic-Releases.ps1
arguments: >
-SourcesDirectory .
-PackagesYmlPath eng/pipelines/patch-release.yml
# Create a PR with the patches prepared
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
PRBranchName: prepare-patch-release-$(Build.BuildId)
CommitMsg: "Patch release preparation"
PRTitle: "Prepare patch release"
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'
11 changes: 0 additions & 11 deletions eng/scripts/Generate-Patches-For-Automatic-Releases.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ try {

# Update POMs for all libraries with dependencies on the libraries to patch. Also, update the READMEs of the latter.
python "${PSScriptRoot}/../versioning/update_versions.py" --update-type library --build-type client --ll $libraryList

Write-Host "git add -A"
git add -A

$commitMessage = "Updated dependencies in libraries and READMEs via version_client.txt"

Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -m $commitMessage"
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit -m $commitMessage

Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" push $remoteName $branchName"
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" push $remoteName $branchName
} catch {
LogError "Failed to update dependencies in libraries and READMEs via version_client.txt"
exit 1
Expand Down

0 comments on commit 43ff155

Please sign in to comment.