Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions eng/scripts/Generate-Patch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ function GetRemoteName($MainRemoteUrl) {
return $null
}

function ResetSourcesToReleaseTag($ArtifactName, $ServiceDirectoryName, $ReleaseVersion, $RepoRoot, $RemoteName) {
$ReleaseTag = "${ArtifactName}_${ReleaseVersion}"
function ResetSourcesToReleaseTag($ArtifactName, $ServiceDirectoryName, $ReleaseVersion, $RepoRoot, $RemoteName, $GroupId = "com.azure") {
$ReleaseTag = "${GroupId}+${ArtifactName}_${ReleaseVersion}"
Write-Information "Resetting the $ArtifactName sources to the release $ReleaseTag."

$SdkDirPath = Join-Path $RepoRoot "sdk"
Expand All @@ -92,7 +92,7 @@ function ResetSourcesToReleaseTag($ArtifactName, $ServiceDirectoryName, $Release
$ArtifactDirPath = Join-Path $ServiceDirPath $ArtifactName
TestPathThrow -Path $ArtifactDirPath -PathName 'ArtifactDirPath'

$pkgProperties = Get-PkgProperties -PackageName $ArtifactName -ServiceDirectory $ServiceDirectoryName
$pkgProperties = Get-PkgProperties -PackageName $ArtifactName -ServiceDirectory $ServiceDirectoryName -GroupId $GroupId
$currentPackageVersion = $pkgProperties.Version
if($currentPackageVersion -eq $ReleaseVersion) {
Write-Information "We do not have to reset the sources."
Expand All @@ -108,8 +108,17 @@ function ResetSourcesToReleaseTag($ArtifactName, $ServiceDirectoryName, $Release
Write-Information "Fetching all the tags from $RemoteName"
$CmdOutput = git fetch $RemoteName $ReleaseTag
if($LASTEXITCODE -ne 0) {
LogError "Could not restore the tags for release tag $ReleaseTag"
exit 1
# Fall back to old tag format: <artifactName>_<version>
$OldReleaseTag = "${ArtifactName}_${ReleaseVersion}"
Write-Information "Failed to fetch new tag format. Trying old tag format: $OldReleaseTag"
$CmdOutput = git fetch $RemoteName $OldReleaseTag

if($LASTEXITCODE -ne 0) {
LogError "Could not restore the tags for release tag $ReleaseTag or $OldReleaseTag"
exit 1
}

$ReleaseTag = $OldReleaseTag
}

$cmdOutput = git restore --source $ReleaseTag -W -S $ArtifactDirPath
Expand Down Expand Up @@ -162,7 +171,7 @@ function CreatePatchRelease($ArtifactName, $ServiceDirectoryName, $PatchVersion,
$EngVersioningDir = Join-Path $EngDir "versioning"
$SetVersionFilePath = Join-Path $EngVersioningDir "set_versions.py"
$UpdateVersionFilePath = Join-Path $EngVersioningDir "update_versions.py"
$pkgProperties = Get-PkgProperties -PackageName $ArtifactName -ServiceDirectory $ServiceDirectoryName
$pkgProperties = Get-PkgProperties -PackageName $ArtifactName -ServiceDirectory $ServiceDirectoryName -GroupId $GroupId
$ChangelogPath = $pkgProperties.ChangeLogPath
$PomFilePath = Join-Path $pkgProperties.DirectoryPath "pom.xml"

Expand Down Expand Up @@ -264,7 +273,7 @@ try {

## Hard resetting it to the contents of the release tag.
## Fetching all the tags from the remote branch
ResetSourcesToReleaseTag -ArtifactName $ArtifactName -ServiceDirectoryName $ServiceDirectoryName -ReleaseVersion $ReleaseVersion -RepoRoot $RepoRoot -RemoteName $RemoteName
ResetSourcesToReleaseTag -ArtifactName $ArtifactName -ServiceDirectoryName $ServiceDirectoryName -ReleaseVersion $ReleaseVersion -RepoRoot $RepoRoot -RemoteName $RemoteName -GroupId $GroupId
CreatePatchRelease -ArtifactName $ArtifactName -ServiceDirectoryName $ServiceDirectoryName -PatchVersion $PatchVersion -RepoRoot $RepoRoot
$cmdOutput = git add $RepoRoot
if($LASTEXITCODE -ne 0) {
Expand Down
4 changes: 2 additions & 2 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function Get-java-PackageInfoFromPackageFile ($pkg, $workingDirectory)
PackageId = $pkgId
GroupId = $groupId
PackageVersion = $pkgVersion
ReleaseTag = "$($pkgId)_$($pkgVersion)"
ReleaseTag = "$($groupId)+$($pkgId)_$($pkgVersion)"
Deployable = $forceCreate -or !(IsMavenPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion -groupId $groupId.Replace(".", "/"))
ReleaseNotes = $releaseNotes
ReadmeContent = $readmeContent
Expand Down Expand Up @@ -551,7 +551,7 @@ function SetPackageVersion ($PackageName, $Version, $ServiceDirectory, $ReleaseD
# -ll option says "only update README and CHANGELOG entries for libraries that are on the list"
python "$EngDir/versioning/update_versions.py" --library-list $fullLibraryName
& "$EngCommonScriptsDir/Update-ChangeLog.ps1" -Version $Version -ServiceDirectory $ServiceDirectory -PackageName $PackageName `
-Unreleased $False -ReplaceLatestEntryTitle $ReplaceLatestEntryTitle -ReleaseDate $ReleaseDate
-Unreleased $False -ReplaceLatestEntryTitle $ReplaceLatestEntryTitle -ReleaseDate $ReleaseDate -GroupId $GroupId
}

function GetExistingPackageVersions ($PackageName, $GroupId=$null)
Expand Down
18 changes: 14 additions & 4 deletions eng/scripts/bomhelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ function GeneratePatch($PatchInfo, [string]$BranchName, [string]$RemoteName, [st
Write-Output "PatchVersion is: $patchVersion"
}

$releaseTag = "$($artifactId)_$($releaseVersion)"
$releaseTag = "$($GroupId)+$($artifactId)_$($releaseVersion)"
if (!$currentPomFileVersion -or !$artifactDirPath -or !$changelogPath) {
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName $artifactId -ServiceDirectory $serviceDirectoryName)
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName $artifactId -ServiceDirectory $serviceDirectoryName -GroupId $GroupId)
$artifactDirPath = $pkgProperties.DirectoryPath
$currentPomFileVersion = $pkgProperties.Version
$changelogPath = $pkgProperties.ChangeLogPath
Expand All @@ -323,8 +323,18 @@ function GeneratePatch($PatchInfo, [string]$BranchName, [string]$RemoteName, [st
$cmdOutput = git fetch $RemoteName $releaseTag

if ($LASTEXITCODE -ne 0) {
LogError "Could not restore the tags for release tag $releaseTag"
exit $LASTEXITCODE
# Fall back to old tag format: <artifactId>_<version>
$oldReleaseTag = "$($artifactId)_$($releaseVersion)"
Write-Output "Failed to fetch new tag format. Trying old tag format: $oldReleaseTag"
Write-Host "git fetch $RemoteName $oldReleaseTag"
$cmdOutput = git fetch $RemoteName $oldReleaseTag

if ($LASTEXITCODE -ne 0) {
LogError "Could not restore the tags for release tag $releaseTag or $oldReleaseTag"
exit $LASTEXITCODE
}

$releaseTag = $oldReleaseTag
}

Write-Host "git restore --source $releaseTag -W -S $artifactDirPath"
Expand Down
4 changes: 2 additions & 2 deletions eng/scripts/patchhelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function UpdateCIInformation($ArtifactInfos) {
$serviceDirectory = $arInfo.ServiceDirectoryName

if (!$serviceDirectory) {
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName $artifactId -ServiceDirectory $serviceDirectory)
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName $artifactId -ServiceDirectory $serviceDirectory -GroupId $arInfo.GroupId)
$arInfo.ServiceDirectoryName = $pkgProperties.ServiceDirectory
$arInfo.ArtifactDirPath = $pkgProperties.DirectoryPath
$arInfo.CurrentPomFileVersion = $pkgProperties.Version
Expand Down Expand Up @@ -188,7 +188,7 @@ function UpdateDependenciesInVersionClient([hashtable]$ArtifactInfos) {

# Get the release version for the next bom artifact.
function GetNextBomVersion() {
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName "azure-sdk-bom")
$pkgProperties = [PackageProps](Get-PkgProperties -PackageName "azure-sdk-bom" -GroupId "com.azure")
$currentVersion = $pkgProperties.Version

$patchVersion = GetPatchVersion -ReleaseVersion $currentVersion
Expand Down