From 3e8dba3e42ae09802b29721c69fba37948f0da92 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 10:07:26 -0700 Subject: [PATCH 01/20] Retrive release tag and replace master link with releaseTag link --- .../templates/steps/publish-blobs.yml | 2 + .../scripts/artifact-metadata-parsing.ps1 | 45 ++++++++++---- .../scripts/copy-docs-to-blobstorage.ps1 | 60 +++++++++++++++---- eng/common/scripts/update-docs-metadata.ps1 | 6 ++ 4 files changed, 91 insertions(+), 22 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 682cc4d4f7c..c4570e347f9 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -4,6 +4,7 @@ parameters: TargetLanguage: '' BlobName: '' ScriptPath: '' + RepoId: $(Build.Repository.Name) steps: - pwsh: | @@ -21,6 +22,7 @@ steps: -SASKey "${{ parameters.BlobSASKey }}" -Language "${{ parameters.TargetLanguage }}" -BlobName "${{ parameters.BlobName }}" + -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master(/.*)" pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Copy Docs to Blob diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index f17e59700b6..37db67c2333 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -387,12 +387,27 @@ function GetExistingTags($apiUrl) { } } -# Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases -function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) { - $pkgList = [array]@() +# Retrieve release tag for artiface package. If multiple packages, then output the first one. +function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError = $true) { + try { + $pkgs, $ParsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation + if (!$pkgs -or !$pkgs[0]) { + return "" + } + $parsedPackage = &$ParsePkgInfoFn -pkg $pkgs[0] + return GenerateReleaseTag $parsedPackage.packageId $parsedPackage.PackageVersion + } + catch { + if ($continueOnError) { + return "" + } + Write-Error "No release tag retrieved from $artifactLocation" + } +} +function RetrivePackages($pkgRepository, $artifactLocation) { $ParsePkgInfoFn = "" $packagePattern = "" - + $pkgRepository = $pkgRepository.Trim() switch ($pkgRepository) { "Maven" { $ParsePkgInfoFn = "ParseMavenPackage" @@ -427,8 +442,14 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a exit(1) } } + $pkgs = Get-ChildItem -Path $artifactLocation -Include $packagePattern -Recurse -File + return $pkgs, $ParsePkgInfoFn +} - $pkgs = (Get-ChildItem -Path $artifactLocation -Include $packagePattern -Recurse -File) +# Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases +function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) { + $pkgList = [array]@() + $pkgs, $ParsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation foreach ($pkg in $pkgs) { try { @@ -444,11 +465,7 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a exit(1) } - $tag = if ($parsedPackage.packageId) { - "$($parsedPackage.packageId)_$($parsedPackage.PackageVersion)" - } else { - $parsedPackage.PackageVersion - } + $tag = GenerateReleaseTag $parsedPackage.packageId $parsedPackage.PackageVersion $pkgList += New-Object PSObject -Property @{ PackageId = $parsedPackage.PackageId @@ -511,4 +528,12 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap Write-Host "Tags already existing with different SHA versions. Exiting." exit(1) } +} + +function GenerateReleaseTag($packageId, $packageVersion) { + return if ($packageId) { + "$packageId_$packageVersion" + } else { + $packageVersion + } } \ No newline at end of file diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index a0893099293..a01f8c03fba 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -7,9 +7,12 @@ param ( $Language, $BlobName, $ExitOnError=1, - $UploadLatest=1 + $UploadLatest=1, + $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master(/.*)" ) +. (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) + $Language = $Language.ToLower() # Regex inspired but simplified from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string @@ -186,7 +189,8 @@ function Upload-Blobs Param ( [Parameter(Mandatory=$true)] [String]$DocDir, [Parameter(Mandatory=$true)] [String]$PkgName, - [Parameter(Mandatory=$true)] [String]$DocVersion + [Parameter(Mandatory=$true)] [String]$DocVersion, + [Parameter(Mandatory=$false)] [String]$ReleaseTag ) #eg : $BlobName = "https://azuresdkdocs.blob.core.windows.net" $DocDest = "$($BlobName)/`$web/$($Language)" @@ -196,7 +200,24 @@ function Upload-Blobs Write-Host "DocVersion $($DocVersion)" Write-Host "DocDir $($DocDir)" Write-Host "Final Dest $($DocDest)/$($PkgName)/$($DocVersion)" + Write-Host "Release Tag $($ReleaseTag)" + # Use the step to replace master link to release tag link + if ($ReleaseTag) { + foreach ($htmlFile in (Get-ChildItem $DocDir -include *.html -r)) + { + $fileContent = Get-Content -Path $htmlFile + $checkPattern = $false + while ($fileContent -match $RepoReplaceRegex) { + $fileContent = $fileContent -replace $RepoReplaceRegex, "`${1}$ReleaseTag`$2" + $checkPattern = $true + } + if ($checkPattern) { + Set-Content -Path $htmlFile -Value $fileContent + } + } + } + Write-Host "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..." & $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)$($SASKey)" --recursive=true @@ -213,7 +234,6 @@ function Upload-Blobs } } - if ($Language -eq "javascript") { $PublishedDocs = Get-ChildItem "$($DocLocation)/documentation" | Where-Object -FilterScript {$_.Name.EndsWith(".zip")} @@ -227,7 +247,11 @@ if ($Language -eq "javascript") if($dirList.Length -eq 1){ $DocVersion = $dirList[0].Name Write-Host "Uploading Doc for $($PkgName) Version:- $($DocVersion)..." - Upload-Blobs -DocDir "$($DocLocation)/documentation/$($Item.BaseName)/$($Item.BaseName)/$($DocVersion)" -PkgName $PkgName -DocVersion $DocVersion + $releaseTag = RetrieveReleaseTag "NPM" "$($DocLocation)/documentation" + if (!releaseTag) { + $releaseTag = GenerateReleaseTag $PkgName $DocVersion + } + Upload-Blobs -DocDir "$($DocLocation)/documentation/$($Item.BaseName)/$($Item.BaseName)/$($DocVersion)" -PkgName $PkgName -DocVersion $DocVersion -ReleaseTag $releaseTag } else{ Write-Host "found more than 1 folder under the documentation for package - $($Item.Name)" @@ -252,7 +276,8 @@ if ($Language -eq "dotnet") Write-Host "DocDir $($Item)" Write-Host "PkgName $($PkgName)" Write-Host "DocVersion $($DocVersion)" - Upload-Blobs -DocDir "$($Item)" -PkgName $PkgName -DocVersion $DocVersion + $releaseTag = RetrieveReleaseTag "Nuget" $DocLocation + Upload-Blobs -DocDir "$($Item)" -PkgName $PkgName -DocVersion $DocVersion -ReleaseTag $releaseTag } else { @@ -279,8 +304,11 @@ if ($Language -eq "python") Write-Host "Discovered Package Name: $PkgName" Write-Host "Discovered Package Version: $Version" Write-Host "Directory for Upload: $UnzippedDocumentationPath" - - Upload-Blobs -DocDir $UnzippedDocumentationPath -PkgName $PkgName -DocVersion $Version + $releaseTag = RetrieveReleaseTag "PyPI" $DocLocation + if (!$releaseTag) { + $releaseTag = GenerateReleaseTag $PkgName $Version + } + Upload-Blobs -DocDir $UnzippedDocumentationPath -PkgName $PkgName -DocVersion $Version -ReleaseTag $releaseTag } } @@ -326,8 +354,8 @@ if ($Language -eq "java") Write-Host "DocDir $($UnjarredDocumentationPath)" Write-Host "PkgName $($ArtifactId)" Write-Host "DocVersion $($Version)" - - Upload-Blobs -DocDir $UnjarredDocumentationPath -PkgName $ArtifactId -DocVersion $Version + $releaseTag = RetrieveReleaseTag "Maven" $DocLocation + Upload-Blobs -DocDir $UnjarredDocumentationPath -PkgName $ArtifactId -DocVersion $Version -ReleaseTag $releaseTag } Finally { if (![string]::IsNullOrEmpty($UnjarredDocumentationPath)) { @@ -349,11 +377,19 @@ if ($Language -eq "c") # Those loops are left over from previous versions of this script which were # used to publish multiple docs packages in a single invocation. $pkgInfo = Get-Content $DocLocation/package-info.json | ConvertFrom-Json - Upload-Blobs -DocDir $DocLocation -PkgName 'docs' -DocVersion $pkgInfo.version + $releaseTag = RetrieveReleaseTag "C" $DocLocation + if (!$releaseTag) { + $releaseTag = GenerateReleaseTag -packageVersion $Version + } + Upload-Blobs -DocDir $DocLocation -PkgName 'docs' -DocVersion $pkgInfo.version -ReleaseTag $releaseTag } if ($Language -eq "cpp") { $packageInfo = (Get-Content (Join-Path $DocLocation 'package-info.json') | ConvertFrom-Json) - Upload-Blobs -DocDir $DocLocation -PkgName $packageInfo.name -DocVersion $packageInfo.version -} \ No newline at end of file + $releaseTag = RetrieveReleaseTag "CPP" $DocLocation + if (!releaseTag) { + $releaseTag = GenerateReleaseTag $packageInfo.name $packageInfo.version + } + Upload-Blobs -DocDir $DocLocation -PkgName $packageInfo.name -DocVersion $packageInfo.version -ReleaseTag $releaseTag +} diff --git a/eng/common/scripts/update-docs-metadata.ps1 b/eng/common/scripts/update-docs-metadata.ps1 index 42ca30894fd..b847a9190dd 100644 --- a/eng/common/scripts/update-docs-metadata.ps1 +++ b/eng/common/scripts/update-docs-metadata.ps1 @@ -17,6 +17,8 @@ param ( . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) . (Join-Path $PSScriptRoot SemVer.ps1) +$releaseReplaceRegex = "(https://github.com/$RepoId/(?:blob|tree)/)master(/.*)" + function GetMetaData($lang){ switch ($lang) { "java" { @@ -75,6 +77,10 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ if ($headerContentMatches) { $foundTitle = $headerContentMatches.Matches[0] $fileContent = $pkgInfo.ReadmeContent -replace $foundTitle, "$foundTitle - Version $($pkgInfo.PackageVersion) `n" + + # Replace github master link with release tag. + $ReplacementPattern = "`${1}$($pkgInfo.Tag)`$2" + $fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern } $header = "---`ntitle: $foundTitle`nkeywords: Azure, $lang, SDK, API, $($pkgInfo.PackageId), $service`nauthor: maggiepint`nms.author: magpint`nms.date: $date`nms.topic: article`nms.prod: azure`nms.technology: azure`nms.devlang: $lang`nms.service: $service`n---`n" From db9fe5fca1a0dcd4155b8dcce7a1de9d3f3c32db Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 10:30:11 -0700 Subject: [PATCH 02/20] fixed bugs --- eng/common/scripts/artifact-metadata-parsing.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 37db67c2333..6a787478fe1 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -531,9 +531,10 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap } function GenerateReleaseTag($packageId, $packageVersion) { - return if ($packageId) { + $tag =if ($packageId) { "$packageId_$packageVersion" } else { $packageVersion } + return $tag } \ No newline at end of file From e355b9db6a79d4f491633d09ecdbe5e474be8620 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 11:39:01 -0700 Subject: [PATCH 03/20] Get sorted the release tag gen --- .../scripts/artifact-metadata-parsing.ps1 | 16 +++++++++--- .../scripts/copy-docs-to-blobstorage.ps1 | 25 ++++++------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 6a787478fe1..6f0e28cb3cb 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -69,6 +69,7 @@ function ParseMavenPackage($pkg, $workingDirectory) { PackageId = $pkgId GroupId = $groupId PackageVersion = $pkgVersion + ReleaseTag = "$pkgId_$pkgVersion" Deployable = $forceCreate -or !(IsMavenPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion -groupId $groupId.Replace(".", "/")) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -150,6 +151,7 @@ function ParseNPMPackage($pkg, $workingDirectory) { $resultObj = New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion + ReleaseTag = "$pkgId_$pkgVersion" Deployable = $forceCreate -or !(IsNPMPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -208,6 +210,7 @@ function ParseNugetPackage($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion + ReleaseTag = "$pkgId_$pkgVersion" Deployable = $forceCreate -or !(IsNugetPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -272,6 +275,7 @@ function ParsePyPIPackage($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion + ReleaseTag = "$pkgId_$pkgVersion" Deployable = $forceCreate -or !(IsPythonPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -300,6 +304,7 @@ function ParseCArtifact($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = '' PackageVersion = $pkgVersion + ReleaseTag = $pkgVersion # Artifact info is always considered deployable for C becasue it is not # deployed anywhere. Dealing with duplicate tags happens downstream in # CheckArtifactShaAgainstTagsList @@ -331,6 +336,7 @@ function ParseCppArtifact($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgName PackageVersion = $pkgVersion + ReleaseTag = "$pkgId_$pkgVersion" # Artifact info is always considered deployable for now becasue it is not # deployed anywhere. Dealing with duplicate tags happens downstream in # CheckArtifactShaAgainstTagsList @@ -389,13 +395,17 @@ function GetExistingTags($apiUrl) { # Retrieve release tag for artiface package. If multiple packages, then output the first one. function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError = $true) { + if (!$artifactLocation) { + Write-Warning "Please provide the artifact location which to retrieve the releaes tag." + return "" + } try { $pkgs, $ParsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation if (!$pkgs -or !$pkgs[0]) { return "" } $parsedPackage = &$ParsePkgInfoFn -pkg $pkgs[0] - return GenerateReleaseTag $parsedPackage.packageId $parsedPackage.PackageVersion + return $parsedPackage.ReleaseTag } catch { if ($continueOnError) { @@ -465,13 +475,11 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a exit(1) } - $tag = GenerateReleaseTag $parsedPackage.packageId $parsedPackage.PackageVersion - $pkgList += New-Object PSObject -Property @{ PackageId = $parsedPackage.PackageId PackageVersion = $parsedPackage.PackageVersion GroupId = $parsedPackage.GroupId - Tag = $tag + Tag = $parsedPackage.ReleaseTag ReleaseNotes = $parsedPackage.ReleaseNotes ReadmeContent = $parsedPackage.ReadmeContent IsPrerelease = [AzureEngSemanticVersion]::ParseVersionString($parsedPackage.PackageVersion).IsPrerelease diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index a01f8c03fba..3e4eb64b596 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -8,6 +8,7 @@ param ( $BlobName, $ExitOnError=1, $UploadLatest=1, + $PublicArtifactLocation = "", $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master(/.*)" ) @@ -247,10 +248,7 @@ if ($Language -eq "javascript") if($dirList.Length -eq 1){ $DocVersion = $dirList[0].Name Write-Host "Uploading Doc for $($PkgName) Version:- $($DocVersion)..." - $releaseTag = RetrieveReleaseTag "NPM" "$($DocLocation)/documentation" - if (!releaseTag) { - $releaseTag = GenerateReleaseTag $PkgName $DocVersion - } + $releaseTag = RetrieveReleaseTag "NPM" $PublicArtifactLocation Upload-Blobs -DocDir "$($DocLocation)/documentation/$($Item.BaseName)/$($Item.BaseName)/$($DocVersion)" -PkgName $PkgName -DocVersion $DocVersion -ReleaseTag $releaseTag } else{ @@ -276,7 +274,7 @@ if ($Language -eq "dotnet") Write-Host "DocDir $($Item)" Write-Host "PkgName $($PkgName)" Write-Host "DocVersion $($DocVersion)" - $releaseTag = RetrieveReleaseTag "Nuget" $DocLocation + $releaseTag = RetrieveReleaseTag "Nuget" $PublicArtifactLocation Upload-Blobs -DocDir "$($Item)" -PkgName $PkgName -DocVersion $DocVersion -ReleaseTag $releaseTag } else @@ -304,10 +302,7 @@ if ($Language -eq "python") Write-Host "Discovered Package Name: $PkgName" Write-Host "Discovered Package Version: $Version" Write-Host "Directory for Upload: $UnzippedDocumentationPath" - $releaseTag = RetrieveReleaseTag "PyPI" $DocLocation - if (!$releaseTag) { - $releaseTag = GenerateReleaseTag $PkgName $Version - } + $releaseTag = RetrieveReleaseTag "PyPI" $PublicArtifactLocation Upload-Blobs -DocDir $UnzippedDocumentationPath -PkgName $PkgName -DocVersion $Version -ReleaseTag $releaseTag } } @@ -354,7 +349,7 @@ if ($Language -eq "java") Write-Host "DocDir $($UnjarredDocumentationPath)" Write-Host "PkgName $($ArtifactId)" Write-Host "DocVersion $($Version)" - $releaseTag = RetrieveReleaseTag "Maven" $DocLocation + $releaseTag = RetrieveReleaseTag "Maven" $PublicArtifactLocation Upload-Blobs -DocDir $UnjarredDocumentationPath -PkgName $ArtifactId -DocVersion $Version -ReleaseTag $releaseTag } Finally { @@ -377,19 +372,13 @@ if ($Language -eq "c") # Those loops are left over from previous versions of this script which were # used to publish multiple docs packages in a single invocation. $pkgInfo = Get-Content $DocLocation/package-info.json | ConvertFrom-Json - $releaseTag = RetrieveReleaseTag "C" $DocLocation - if (!$releaseTag) { - $releaseTag = GenerateReleaseTag -packageVersion $Version - } + $releaseTag = RetrieveReleaseTag "C" $PublicArtifactLocation Upload-Blobs -DocDir $DocLocation -PkgName 'docs' -DocVersion $pkgInfo.version -ReleaseTag $releaseTag } if ($Language -eq "cpp") { $packageInfo = (Get-Content (Join-Path $DocLocation 'package-info.json') | ConvertFrom-Json) - $releaseTag = RetrieveReleaseTag "CPP" $DocLocation - if (!releaseTag) { - $releaseTag = GenerateReleaseTag $packageInfo.name $packageInfo.version - } + $releaseTag = RetrieveReleaseTag "CPP" $PublicArtifactLocation Upload-Blobs -DocDir $DocLocation -PkgName $packageInfo.name -DocVersion $packageInfo.version -ReleaseTag $releaseTag } From 8a299edd6bfde3a60c7e14bb37f2e01dfbd3dfa9 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 11:41:19 -0700 Subject: [PATCH 04/20] Remove extra function --- eng/common/scripts/artifact-metadata-parsing.ps1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 6f0e28cb3cb..d9068df4d07 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -536,13 +536,4 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap Write-Host "Tags already existing with different SHA versions. Exiting." exit(1) } -} - -function GenerateReleaseTag($packageId, $packageVersion) { - $tag =if ($packageId) { - "$packageId_$packageVersion" - } else { - $packageVersion - } - return $tag } \ No newline at end of file From b3a04b88bc9b19693a11917cf1beb143254a351f Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 12:09:44 -0700 Subject: [PATCH 05/20] change publish blobs --- eng/common/pipelines/templates/steps/publish-blobs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index c4570e347f9..3a1e615412a 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -4,6 +4,7 @@ parameters: TargetLanguage: '' BlobName: '' ScriptPath: '' + ArtifactLocation: '' RepoId: $(Build.Repository.Name) steps: @@ -22,6 +23,7 @@ steps: -SASKey "${{ parameters.BlobSASKey }}" -Language "${{ parameters.TargetLanguage }}" -BlobName "${{ parameters.BlobName }}" + -PublicArtifactLocation "${{ parameters.ArtifactLocation}}"" -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master(/.*)" pwsh: true workingDirectory: $(Pipeline.Workspace) From bcc55061f47d0f59c29d4789a130315602b8e4c2 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 14:36:02 -0700 Subject: [PATCH 06/20] Remove extra logging --- eng/common/scripts/artifact-metadata-parsing.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index d9068df4d07..6fa03ffc6c3 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -396,7 +396,6 @@ function GetExistingTags($apiUrl) { # Retrieve release tag for artiface package. If multiple packages, then output the first one. function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError = $true) { if (!$artifactLocation) { - Write-Warning "Please provide the artifact location which to retrieve the releaes tag." return "" } try { From 6cf437bcdb04e7bb698a7dafc3962efec6a8e9d7 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 16:02:11 -0700 Subject: [PATCH 07/20] make changes to simple regex --- .../pipelines/templates/steps/publish-blobs.yml | 2 +- eng/common/scripts/copy-docs-to-blobstorage.ps1 | 12 ++++-------- eng/common/scripts/update-docs-metadata.ps1 | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 3a1e615412a..4c5f6ea648b 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -24,7 +24,7 @@ steps: -Language "${{ parameters.TargetLanguage }}" -BlobName "${{ parameters.BlobName }}" -PublicArtifactLocation "${{ parameters.ArtifactLocation}}"" - -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master(/.*)" + -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master" pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Copy Docs to Blob diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index 3e4eb64b596..502a357056f 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -9,7 +9,7 @@ param ( $ExitOnError=1, $UploadLatest=1, $PublicArtifactLocation = "", - $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master(/.*)" + $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master" ) . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) @@ -208,13 +208,9 @@ function Upload-Blobs foreach ($htmlFile in (Get-ChildItem $DocDir -include *.html -r)) { $fileContent = Get-Content -Path $htmlFile - $checkPattern = $false - while ($fileContent -match $RepoReplaceRegex) { - $fileContent = $fileContent -replace $RepoReplaceRegex, "`${1}$ReleaseTag`$2" - $checkPattern = $true - } - if ($checkPattern) { - Set-Content -Path $htmlFile -Value $fileContent + $updatedFileContent = $fileContent -replace $RepoReplaceRegex, "`${1}$ReleaseTag" + if ($updatedFileContent -ne $fileContent) { + Set-Content -Path $htmlFile -Value $updatedFileContent } } } diff --git a/eng/common/scripts/update-docs-metadata.ps1 b/eng/common/scripts/update-docs-metadata.ps1 index b847a9190dd..7cf65fa7d2a 100644 --- a/eng/common/scripts/update-docs-metadata.ps1 +++ b/eng/common/scripts/update-docs-metadata.ps1 @@ -17,7 +17,7 @@ param ( . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) . (Join-Path $PSScriptRoot SemVer.ps1) -$releaseReplaceRegex = "(https://github.com/$RepoId/(?:blob|tree)/)master(/.*)" +$releaseReplaceRegex = "(https://github.com/$RepoId/(?:blob|tree)/)master" function GetMetaData($lang){ switch ($lang) { @@ -79,7 +79,7 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ $fileContent = $pkgInfo.ReadmeContent -replace $foundTitle, "$foundTitle - Version $($pkgInfo.PackageVersion) `n" # Replace github master link with release tag. - $ReplacementPattern = "`${1}$($pkgInfo.Tag)`$2" + $ReplacementPattern = "`${1}$($pkgInfo.Tag)" $fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern } From d4046c617e5631a7d915e08fcd427643c5cea3c3 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 16:33:12 -0700 Subject: [PATCH 08/20] Added warning messages --- eng/common/scripts/copy-docs-to-blobstorage.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index 502a357056f..3f3029512ca 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -214,6 +214,9 @@ function Upload-Blobs } } } + else { + Write-Warning "Not able to do the master link replacement, since no release tag found for the release. Please manually check." + } Write-Host "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..." & $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)$($SASKey)" --recursive=true From d860b677f6d090f6e2d2342927295f4b63a22ef6 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 18:08:51 -0700 Subject: [PATCH 09/20] fix type --- eng/common/pipelines/templates/steps/publish-blobs.yml | 2 +- eng/common/scripts/artifact-metadata-parsing.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 4c5f6ea648b..5888edff87d 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -23,7 +23,7 @@ steps: -SASKey "${{ parameters.BlobSASKey }}" -Language "${{ parameters.TargetLanguage }}" -BlobName "${{ parameters.BlobName }}" - -PublicArtifactLocation "${{ parameters.ArtifactLocation}}"" + -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master" pwsh: true workingDirectory: $(Pipeline.Workspace) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 6fa03ffc6c3..22cd75ad207 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -101,7 +101,8 @@ function IsMavenPackageVersionPublished($pkgId, $pkgVersion, $groupId) { Write-Host "VersionCheck to maven for packageId $pkgId failed with statuscode $statusCode" Write-Host $statusDescription - exit(1) + #exit(1) + return } } @@ -533,6 +534,6 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap if ($unmatchedTags.Length -gt 0 -and !$continueOnError) { Write-Host "Tags already existing with different SHA versions. Exiting." - exit(1) + #exit(1) } } \ No newline at end of file From dbc4c7e2a34e678476684f9fe89613bb5f946350 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 22:00:33 -0700 Subject: [PATCH 10/20] revert chagnes --- eng/common/scripts/artifact-metadata-parsing.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 22cd75ad207..46dedd8342b 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -534,6 +534,6 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap if ($unmatchedTags.Length -gt 0 -and !$continueOnError) { Write-Host "Tags already existing with different SHA versions. Exiting." - #exit(1) + exit(1) } } \ No newline at end of file From 8f7a4fa26b2c11f8b0e7a9a876153464efe70d22 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 22:04:01 -0700 Subject: [PATCH 11/20] revert chagnes --- eng/common/scripts/artifact-metadata-parsing.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 46dedd8342b..6fa03ffc6c3 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -101,8 +101,7 @@ function IsMavenPackageVersionPublished($pkgId, $pkgVersion, $groupId) { Write-Host "VersionCheck to maven for packageId $pkgId failed with statuscode $statusCode" Write-Host $statusDescription - #exit(1) - return + exit(1) } } From ff8443f7c2df3ec0ad85c56d478f483d06ed64aa Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Wed, 2 Sep 2020 23:28:06 -0700 Subject: [PATCH 12/20] Change the release tag format --- eng/common/scripts/artifact-metadata-parsing.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 6fa03ffc6c3..d49198225f1 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -69,7 +69,7 @@ function ParseMavenPackage($pkg, $workingDirectory) { PackageId = $pkgId GroupId = $groupId PackageVersion = $pkgVersion - ReleaseTag = "$pkgId_$pkgVersion" + ReleaseTag = "$($pkgId)_$($pkgVersion)" Deployable = $forceCreate -or !(IsMavenPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion -groupId $groupId.Replace(".", "/")) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -151,7 +151,7 @@ function ParseNPMPackage($pkg, $workingDirectory) { $resultObj = New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion - ReleaseTag = "$pkgId_$pkgVersion" + ReleaseTag = "$($pkgId)_$($pkgVersion)" Deployable = $forceCreate -or !(IsNPMPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -210,7 +210,7 @@ function ParseNugetPackage($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion - ReleaseTag = "$pkgId_$pkgVersion" + ReleaseTag = "$($pkgId)_$($pkgVersion)" Deployable = $forceCreate -or !(IsNugetPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -275,7 +275,7 @@ function ParsePyPIPackage($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgId PackageVersion = $pkgVersion - ReleaseTag = "$pkgId_$pkgVersion" + ReleaseTag = "$($pkgId)_$($pkgVersion)" Deployable = $forceCreate -or !(IsPythonPackageVersionPublished -pkgId $pkgId -pkgVersion $pkgVersion) ReleaseNotes = $releaseNotes ReadmeContent = $readmeContent @@ -336,7 +336,7 @@ function ParseCppArtifact($pkg, $workingDirectory) { return New-Object PSObject -Property @{ PackageId = $pkgName PackageVersion = $pkgVersion - ReleaseTag = "$pkgId_$pkgVersion" + ReleaseTag = "$($pkgId)_$($pkgVersion)" # Artifact info is always considered deployable for now becasue it is not # deployed anywhere. Dealing with duplicate tags happens downstream in # CheckArtifactShaAgainstTagsList From e909a87ec574b7cfd0403d99af2b201a50f531ac Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 10:34:47 -0700 Subject: [PATCH 13/20] change the var name --- .../scripts/artifact-metadata-parsing.ps1 | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index d49198225f1..9a2a988f039 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -399,11 +399,11 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError return "" } try { - $pkgs, $ParsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation + $pkgs, $parsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation if (!$pkgs -or !$pkgs[0]) { return "" } - $parsedPackage = &$ParsePkgInfoFn -pkg $pkgs[0] + $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] return $parsedPackage.ReleaseTag } catch { @@ -414,36 +414,36 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError } } function RetrivePackages($pkgRepository, $artifactLocation) { - $ParsePkgInfoFn = "" + $parsePkgInfoFn = "" $packagePattern = "" $pkgRepository = $pkgRepository.Trim() switch ($pkgRepository) { "Maven" { - $ParsePkgInfoFn = "ParseMavenPackage" + $parsePkgInfoFn = "ParseMavenPackage" $packagePattern = "*.pom" break } "Nuget" { - $ParsePkgInfoFn = "ParseNugetPackage" + $parsePkgInfoFn = "ParseNugetPackage" $packagePattern = "*.nupkg" break } "NPM" { - $ParsePkgInfoFn = "ParseNPMPackage" + $parsePkgInfoFn = "ParseNPMPackage" $packagePattern = "*.tgz" break } "PyPI" { - $ParsePkgInfoFn = "ParsePyPIPackage" + $parsePkgInfoFn = "ParsePyPIPackage" $packagePattern = "*.zip" break } "C" { - $ParsePkgInfoFn = "ParseCArtifact" + $parsePkgInfoFn = "ParseCArtifact" $packagePattern = "*.json" } "CPP" { - $ParsePkgInfoFn = "ParseCppArtifact" + $parsePkgInfoFn = "ParseCppArtifact" $packagePattern = "*.json" } default { @@ -452,17 +452,17 @@ function RetrivePackages($pkgRepository, $artifactLocation) { } } $pkgs = Get-ChildItem -Path $artifactLocation -Include $packagePattern -Recurse -File - return $pkgs, $ParsePkgInfoFn + return $pkgs, $parsePkgInfoFn } # Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) { $pkgList = [array]@() - $pkgs, $ParsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation + $pkgs, $parsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation foreach ($pkg in $pkgs) { try { - $parsedPackage = &$ParsePkgInfoFn -pkg $pkg -workingDirectory $workingDirectory + $parsedPackage = &$parsePkgInfoFn -pkg $pkg -workingDirectory $workingDirectory if ($parsedPackage -eq $null) { continue From 03a77c32014b0098d90c47f66625948628d0809a Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 12:28:33 -0700 Subject: [PATCH 14/20] minor --- eng/common/scripts/copy-docs-to-blobstorage.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index 3f3029512ca..9b7dea48b1d 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -11,7 +11,6 @@ param ( $PublicArtifactLocation = "", $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master" ) - . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) $Language = $Language.ToLower() From d4048a5d232ee90f03d45d644929008a247ddaff Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 13:10:01 -0700 Subject: [PATCH 15/20] fixed typo --- eng/common/scripts/artifact-metadata-parsing.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 9a2a988f039..e85afe06fab 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -399,7 +399,7 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError return "" } try { - $pkgs, $parsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation + $pkgs, $parsePkgInfoFn = RetrievePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation if (!$pkgs -or !$pkgs[0]) { return "" } @@ -413,7 +413,7 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError Write-Error "No release tag retrieved from $artifactLocation" } } -function RetrivePackages($pkgRepository, $artifactLocation) { +function RetrievePackages($pkgRepository, $artifactLocation) { $parsePkgInfoFn = "" $packagePattern = "" $pkgRepository = $pkgRepository.Trim() @@ -458,7 +458,7 @@ function RetrivePackages($pkgRepository, $artifactLocation) { # Walk across all build artifacts, check them against the appropriate repository, return a list of tags/releases function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) { $pkgList = [array]@() - $pkgs, $parsePkgInfoFn = RetrivePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation + $pkgs, $parsePkgInfoFn = RetrievePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation foreach ($pkg in $pkgs) { try { From 3c2d23d402da844129da3e8dd8443b8663fda52e Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 15:57:46 -0700 Subject: [PATCH 16/20] Put more logging message out. --- eng/common/scripts/artifact-metadata-parsing.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index e85afe06fab..3db5be5c958 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -401,6 +401,11 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError try { $pkgs, $parsePkgInfoFn = RetrievePackages -pkgRepository $pkgRepository -artifactLocation $artifactLocation if (!$pkgs -or !$pkgs[0]) { + Write-Host "No packages retrieved from artifact location." + return "" + } + if ($pkgs.Count > 1) { + Write-Host "There are more than 1 packages retieved from artifact location." return "" } $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] From db26f23ebe621539832f880e707bdb79d18e3c7f Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Thu, 3 Sep 2020 16:02:02 -0700 Subject: [PATCH 17/20] Update eng/common/scripts/artifact-metadata-parsing.ps1 Co-authored-by: Wes Haggard --- eng/common/scripts/artifact-metadata-parsing.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 3db5be5c958..2a1be681273 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -404,7 +404,7 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError Write-Host "No packages retrieved from artifact location." return "" } - if ($pkgs.Count > 1) { + if ($pkgs.Count -gt 1) { Write-Host "There are more than 1 packages retieved from artifact location." return "" } @@ -540,4 +540,4 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap Write-Host "Tags already existing with different SHA versions. Exiting." exit(1) } -} \ No newline at end of file +} From aa5252c31eb1a5366f1e9a64e9733ed7883a3e1b Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 16:12:34 -0700 Subject: [PATCH 18/20] Print each of the package name --- eng/common/scripts/artifact-metadata-parsing.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 2a1be681273..baebeee8ee1 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -406,9 +406,12 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError } if ($pkgs.Count -gt 1) { Write-Host "There are more than 1 packages retieved from artifact location." + foreach ($pkg in $pkgs) { + Write-Host "The package name is $($pkg.BaseName)" + } return "" } - $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] + $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] -workDirectory return $parsedPackage.ReleaseTag } catch { From eb4d5f942d0e12957170b11013b73782b8229bf2 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 16:14:23 -0700 Subject: [PATCH 19/20] add workdirectory --- eng/common/scripts/artifact-metadata-parsing.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index baebeee8ee1..560b3595350 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -411,7 +411,7 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError } return "" } - $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] -workDirectory + $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] -workDirectory $artifactLocation return $parsedPackage.ReleaseTag } catch { From e58e0524b5761498f795217fb65c10a59b2268a5 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 3 Sep 2020 19:25:05 -0700 Subject: [PATCH 20/20] fixed parameter typo --- eng/common/scripts/artifact-metadata-parsing.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index 560b3595350..94e95ca170d 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -411,7 +411,7 @@ function RetrieveReleaseTag($pkgRepository, $artifactLocation, $continueOnError } return "" } - $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] -workDirectory $artifactLocation + $parsedPackage = &$parsePkgInfoFn -pkg $pkgs[0] -workingDirectory $artifactLocation return $parsedPackage.ReleaseTag } catch {