Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools repository (#11472)
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-sdk authored May 19, 2020
1 parent af6b719 commit 30e60ef
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,3 @@ steps:
BaseBranchName: smoke-test
WorkingDirectory: ${{parameters.WorkingDirectory}}/repo
ScriptDirectory: ${{parameters.WorkingDirectory}}/${{parameters.ScriptDirectory}}



12 changes: 6 additions & 6 deletions eng/common/scripts/artifact-metadata-parsing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ 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, $exitOnError = $True) {
function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $apiUrl, $releaseSha, $continueOnError = $false) {
$pkgList = [array]@()
$ParsePkgInfoFn = ""
$packagePattern = ""
Expand Down Expand Up @@ -404,7 +404,7 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a
continue
}

if ($parsedPackage.Deployable -ne $True -and $exitOnError) {
if ($parsedPackage.Deployable -ne $True -and !$continueOnError) {
Write-Host "Package $($parsedPackage.PackageId) is marked with version $($parsedPackage.PackageVersion), the version $($parsedPackage.PackageVersion) has already been deployed to the target repository."
Write-Host "Maybe a pkg version wasn't updated properly?"
exit(1)
Expand All @@ -430,8 +430,8 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a

$intersect = $results | % { $_.Tag } | ? { $existingTags -contains $_ }

if ($intersect.Length -gt 0 -and $exitOnError) {
CheckArtifactShaAgainstTagsList -priorExistingTagList $intersect -releaseSha $releaseSha -apiUrl $apiUrl -exitOnError $exitOnError
if ($intersect.Length -gt 0 -and !$continueOnError) {
CheckArtifactShaAgainstTagsList -priorExistingTagList $intersect -releaseSha $releaseSha -apiUrl $apiUrl -continueOnError $continueOnError

# all the tags are clean. remove them from the list of releases we will publish.
$results = $results | ? { -not ($intersect -contains $_.Tag ) }
Expand All @@ -443,7 +443,7 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a
# given a set of tags that we want to release, we need to ensure that if they already DO exist.
# if they DO exist, quietly exit if the commit sha of the artifact matches that of the tag
# if the commit sha does not match, exit with error and report both problem shas
function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $apiUrl, $exitOnError) {
function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $apiUrl, $continueOnError) {
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "token $($env:GH_TOKEN)"
Expand All @@ -465,7 +465,7 @@ function CheckArtifactShaAgainstTagsList($priorExistingTagList, $releaseSha, $ap
}
}

if ($unmatchedTags.Length -gt 0 -and $exitOnError) {
if ($unmatchedTags.Length -gt 0 -and !$continueOnError) {
Write-Host "Tags already existing with different SHA versions. Exiting."
exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions eng/common/scripts/create-tags-and-git-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ param (
$repoOwner = "", # the owning organization of the repository. EG "Azure"
$repoName = "", # the name of the repository. EG "azure-sdk-for-java"
$repoId = "$repoOwner/$repoName", # full repo id. EG azure/azure-sdk-for-net DevOps: $(Build.Repository.Id),
[switch]$forceCreate = $false
[switch]$continueOnError = $false
)

Write-Host "> $PSCommandPath $args"
Expand All @@ -26,7 +26,7 @@ $apiUrl = "https://api.github.com/repos/$repoId"
Write-Host "Using API URL $apiUrl"

# VERIFY PACKAGES
$pkgList = VerifyPackages -pkgRepository $packageRepository -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha
$pkgList = VerifyPackages -pkgRepository $packageRepository -artifactLocation $artifactLocation -workingDirectory $workingDirectory -apiUrl $apiUrl -releaseSha $releaseSha -continueOnError $continueOnError

if ($pkgList) {
Write-Host "Given the visible artifacts, github releases will be created for the following:"
Expand Down
2 changes: 1 addition & 1 deletion eng/common/scripts/update-docs-metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ $pkgs = VerifyPackages -pkgRepository $Repository `
-workingDirectory $WorkDirectory `
-apiUrl $apiUrl `
-releaseSha $ReleaseSHA `
-exitOnError $False
-continueOnError $True

if ($pkgs) {
Write-Host "Given the visible artifacts, readmes will be copied for the following packages"
Expand Down

0 comments on commit 30e60ef

Please sign in to comment.