-
Notifications
You must be signed in to change notification settings - Fork 982
add manual tag and release pipeline for track2 #15346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
99de990
f947a75
5b15e1a
5d55672
f2f5e75
6737356
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| parameters: | ||
| DependsOn: Build | ||
| ServiceDirectory: '' | ||
|
|
||
| stages: | ||
| - ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}: | ||
| - stage: Release | ||
| displayName: 'Release: ${{parameters.ServiceDirectory}}' | ||
| dependsOn: ${{parameters.DependsOn}} | ||
| condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-go-pr')) | ||
| jobs: | ||
| - deployment: TagRepository | ||
| displayName: "Create release tag" | ||
| condition: ne(variables['Skip.TagRepository'], 'true') | ||
| environment: github | ||
|
|
||
| pool: | ||
| name: azsdk-pool-mms-ubuntu-2004-general | ||
| vmImage: MMSUbuntu20.04 | ||
|
|
||
| strategy: | ||
| runOnce: | ||
| deploy: | ||
| steps: | ||
| - checkout: self | ||
| - template: /eng/common/pipelines/templates/steps/retain-run.yml | ||
| - template: /eng/common/pipelines/templates/steps/create-tags-and-git-release.yml | ||
| parameters: | ||
| ArtifactLocation: $(Build.SourcesDirectory)/sdk/${{parameters.ServiceDirectory}} | ||
| ReleaseSha: $(Build.SourceVersion) | ||
| RepoId: Azure/azure-sdk-for-go | ||
| WorkingDirectory: $(System.DefaultWorkingDirectory) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| $Language = "go" | ||
| $packagePattern = "go.mod" | ||
| # rewrite from ChangeLog-Operations.ps1 used in Get-ChangeLogEntriesFromContent for go uses vx.x.x as version number | ||
| $RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+\s+(?<version>v$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?<releaseStatus>\(.+\))))" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chidozieononiwu we consider adding an option "v?" to our core regex instead of duplicating this. We do similar support for python in our Regex already which supports different prerelease labels.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether there's already a definitely plan for this version compatibility change. Could we use the rewrite workaround before the eventually solution cause there are lots of release work for mgmt plane sdk refreshment recently.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There isn't a plan for this currently and I think what you have is an acceptable workaround for now. |
||
|
|
||
| # rewrite from artifact-metadata-parsing.ps1 used in RetrievePackages for fetch go single module info | ||
| function Get-go-PackageInfoFromPackageFile ($pkg, $workingDirectory) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this method can also serve as
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Go release process has no package process and all package info can get directly from repo. But in order to reuse 'create-tag-and-git-release.ps1' script in eng sys which use Get-go-PackageInfoFromPackageFile to get release info, I create this function by tradeoff.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should definitely share and reuse this logic for both the packagefile and packageinfo. @chidozieononiwu at some point I want to eliminate FromPackageFile function completely and either use PackageInfo or use the PackageInfo.json file we are generating as part of the build. |
||
| { | ||
| $workFolder = $pkg.Directory | ||
| $releaseNotes = "" | ||
|
|
||
| if ($workFolder -match "sdk[\/|\\]((?<repopath>(?<service>.*?)[\/|\\])?(?<arm>arm)?(?<pkgname>.*))") | ||
| { | ||
| if ($matches["arm"]) | ||
| { | ||
| $packageName = "arm" + $matches["pkgname"] | ||
| $rpName = $matches["service"] | ||
| $pkgId = "sdk/$rpName/$packageName" | ||
| } | ||
| else | ||
| { | ||
| $packageName = $matches["pkgname"] | ||
| $pkgId = "sdk/$packageName" | ||
| } | ||
| } | ||
|
|
||
| $pkgVersion = Get-Version $workFolder | ||
|
|
||
| $changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] | ||
| if ($changeLogLoc) | ||
| { | ||
| $releaseNotes = Get-ChangeLogEntryAsString -ChangeLogLocation $changeLogLoc -VersionString v$pkgVersion | ||
| } | ||
|
|
||
| $resultObj = New-Object PSObject -Property @{ | ||
| PackageId = $pkgId | ||
| PackageVersion = $pkgVersion | ||
| ReleaseTag = "$pkgId/v$pkgVersion" | ||
| Deployable = $true | ||
| ReleaseNotes = $releaseNotes | ||
| } | ||
|
|
||
| return $resultObj | ||
| } | ||
|
|
||
| # get version from specific files (*constants.go, *version.go) | ||
| function Get-Version ($pkgPath) | ||
| { | ||
| # find any file with suffix | ||
| $versionFiles = @() | ||
| $version_file_suffixs = "*constants.go", "*version.go" | ||
| foreach ($versionFileSuffix in $version_file_suffixs) | ||
| { | ||
| Get-ChildItem -Recurse -Path $pkgPath -Filter $versionFileSuffix | ForEach-Object { | ||
| Write-Host "Adding $_ to list of version files" | ||
| $versionFiles += $_ | ||
| } | ||
| } | ||
|
|
||
| # for each version file, use regex to search go version num | ||
| $go_version_regex = ".+\s*=\s*`".*v?(?<version>$([AzureEngSemanticVersion]::SEMVER_REGEX))`"" | ||
| foreach ($versionFile in $versionFiles) | ||
| { | ||
| try | ||
| { | ||
| $content = Get-Content $versionFile -Raw | ||
| # finding where the version number are | ||
| if ($content -match $go_version_regex) | ||
| { | ||
| return $matches["version"] | ||
| } | ||
| } | ||
| catch | ||
| { | ||
| Write-Error "Error parsing version." | ||
| Write-Error $_ | ||
| } | ||
| } | ||
|
|
||
| Write-Host "Cannot find release version." | ||
| exit 1 | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this conditional is unnecessary since you're also including it in the template include for the archetype-sdk-client.yml file.