Skip to content

Commit 4f75f64

Browse files
Fixing regression in cosmos release pipeline preventing to release just Cosmos Spark connector (all uber jars) (Azure#29500)
* Fixing analytics violations found in release pipeline * Removing noisy log * Updating md files with release version * Fixing regression in cosmos release pipeline preveting to release just Spark connector (all uber jars)
1 parent b27c6e1 commit 4f75f64

File tree

1 file changed

+60
-53
lines changed

1 file changed

+60
-53
lines changed

eng/versioning/verify_release_set.ps1

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ param(
33
[System.String] $ServiceDirectory,
44
# ArtifactsList will be using ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object name, groupId, uberJar | Where-Object -Not "uberJar")
55
[Parameter(Mandatory=$true)]
6+
[AllowEmptyCollection()]
67
[array] $ArtifactsList
78
)
89

@@ -20,72 +21,78 @@ $missingLibraries = @{}
2021

2122
Write-Host "ServiceDirectory=$($ServiceDirectory)"
2223
Write-Host "ArtifactsList:"
23-
$ArtifactsList | Format-Table -Property GroupId, Name | Out-String | Write-Host
24-
foreach($artifact in $ArtifactsList) {
25-
$librariesToRelease.Add("$($artifact.groupId):$($artifact.name)", $true)
26-
}
2724

28-
foreach($artifact in $ArtifactsList) {
29-
$script:FoundPomFile = $false
30-
$inputGroupId = $artifact.groupId
31-
$inputArtifactId = $artifact.name
32-
# It's unfortunate that we have to find the POM file this way for a given group/artifact.
33-
# The reason is because an sdk/<area> should have subdirectories named for each artifact but
34-
# that's not always the case so we need to discover.
35-
foreach($file in Get-ChildItem -Path $ServiceDirectory -Filter pom*.xml -Recurse -File) {
36-
$pomFile = $file.FullName
37-
$xmlPomFile = New-Object xml
38-
$xmlPomFile.Load($pomFile)
39-
if (($xmlPomFile.project.groupId -eq $inputGroupId) -and ($xmlPomFile.project.artifactId -eq $inputArtifactId)) {
40-
$script:FoundPomFile = $true
41-
# Verify that each current dependency is contained within the list of libraries to be released
42-
foreach($dependencyNode in $xmlPomFile.GetElementsByTagName("dependency"))
43-
{
44-
$artifactId = $dependencyNode.artifactId
45-
$groupId = $dependencyNode.groupId
46-
$versionNode = $dependencyNode.GetElementsByTagName("version")[0]
25+
if ($ArtifactsList.Count -gt 0) {
4726

48-
$scopeNode = $dependencyNode.GetElementsByTagName("scope")[0]
49-
if ($scopeNode -and $scopeNode.InnerText.Trim() -eq "test")
50-
{
51-
continue
52-
}
53-
# if there is no version update tag for the dependency then fail
54-
if ($versionNode.NextSibling -and $versionNode.NextSibling.NodeType -eq "Comment")
27+
$ArtifactsList | Format-Table -Property GroupId, Name | Out-String | Write-Host
28+
foreach($artifact in $ArtifactsList) {
29+
$librariesToRelease.Add("$($artifact.groupId):$($artifact.name)", $true)
30+
}
31+
32+
foreach($artifact in $ArtifactsList) {
33+
$script:FoundPomFile = $false
34+
$inputGroupId = $artifact.groupId
35+
$inputArtifactId = $artifact.name
36+
# It's unfortunate that we have to find the POM file this way for a given group/artifact.
37+
# The reason is because an sdk/<area> should have subdirectories named for each artifact but
38+
# that's not always the case so we need to discover.
39+
foreach($file in Get-ChildItem -Path $ServiceDirectory -Filter pom*.xml -Recurse -File) {
40+
$pomFile = $file.FullName
41+
$xmlPomFile = New-Object xml
42+
$xmlPomFile.Load($pomFile)
43+
if (($xmlPomFile.project.groupId -eq $inputGroupId) -and ($xmlPomFile.project.artifactId -eq $inputArtifactId)) {
44+
$script:FoundPomFile = $true
45+
# Verify that each current dependency is contained within the list of libraries to be released
46+
foreach($dependencyNode in $xmlPomFile.GetElementsByTagName("dependency"))
5547
{
56-
$versionUpdateTag = $versionNode.NextSibling.Value.Trim()
57-
if ($versionUpdateTag -match ";current}")
48+
$artifactId = $dependencyNode.artifactId
49+
$groupId = $dependencyNode.groupId
50+
$versionNode = $dependencyNode.GetElementsByTagName("version")[0]
51+
52+
$scopeNode = $dependencyNode.GetElementsByTagName("scope")[0]
53+
if ($scopeNode -and $scopeNode.InnerText.Trim() -eq "test")
54+
{
55+
continue
56+
}
57+
# if there is no version update tag for the dependency then fail
58+
if ($versionNode.NextSibling -and $versionNode.NextSibling.NodeType -eq "Comment")
5859
{
59-
$libraryToVerify = "$($groupId):$($artifactId)"
60-
if (!$librariesToRelease.ContainsKey($libraryToVerify)) {
61-
if (!$missingLibraries.ContainsKey($libraryToVerify)) {
62-
$missingLibraries[$libraryToVerify] = $true
60+
$versionUpdateTag = $versionNode.NextSibling.Value.Trim()
61+
if ($versionUpdateTag -match ";current}")
62+
{
63+
$libraryToVerify = "$($groupId):$($artifactId)"
64+
if (!$librariesToRelease.ContainsKey($libraryToVerify)) {
65+
if (!$missingLibraries.ContainsKey($libraryToVerify)) {
66+
$missingLibraries[$libraryToVerify] = $true
67+
}
68+
$script:FoundError = $true
69+
LogError "Error: $($pomFile) contains a current dependency, groupId=$($groupId), artifactId=$($artifactId), which is not the list of libraries to be released."
6370
}
64-
$script:FoundError = $true
65-
LogError "Error: $($pomFile) contains a current dependency, groupId=$($groupId), artifactId=$($artifactId), which is not the list of libraries to be released."
6671
}
6772
}
6873
}
6974
}
7075
}
71-
}
7276

73-
if (!$script:FoundPomFile) {
74-
LogError "Did not find pom file with matching groupId=$($inputGroupId) and artifactId=$($inputArtifactId) under ServiceDirectory=$($ServiceDirectory)"
75-
$script:FoundError = $true
77+
if (!$script:FoundPomFile) {
78+
LogError "Did not find pom file with matching groupId=$($inputGroupId) and artifactId=$($inputArtifactId) under ServiceDirectory=$($ServiceDirectory)"
79+
$script:FoundError = $true
80+
}
7681
}
77-
}
7882

79-
Write-Host "Elapsed Time=$($resultstime.Elapsed.ToString('dd\.hh\:mm\:ss'))"
80-
if ($script:FoundError) {
81-
if ($missingLibraries.Count -gt 0) {
82-
LogError "The following library or libraries are dependencies of one or more of libaries to be released but not on the release list:"
83-
foreach ($missingLibrary in $missingLibraries.Keys) {
84-
LogError $missingLibrary
83+
Write-Host "Elapsed Time=$($resultstime.Elapsed.ToString('dd\.hh\:mm\:ss'))"
84+
if ($script:FoundError) {
85+
if ($missingLibraries.Count -gt 0) {
86+
LogError "The following library or libraries are dependencies of one or more of libaries to be released but not on the release list:"
87+
foreach ($missingLibrary in $missingLibraries.Keys) {
88+
LogError $missingLibrary
89+
}
90+
LogError "If any of the above libraries are not released from $($ServiceDirectory) then the tag is incorrectly set to current and should be dependency."
8591
}
86-
LogError "If any of the above libraries are not released from $($ServiceDirectory) then the tag is incorrectly set to current and should be dependency."
92+
exit(1)
8793
}
88-
exit(1)
89-
}
9094

91-
Write-Host "The library list to release contains full transitive closure and looks good to release"
95+
Write-Host "The library list to release contains full transitive closure and looks good to release"
96+
} else {
97+
Write-Host "The library list to release contains no non-uber jars. No transitive closure check needed for uber-jars."
98+
}

0 commit comments

Comments
 (0)