-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Support artifacts published from any location #6268
Changes from 1 commit
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 |
---|---|---|
|
@@ -38,6 +38,11 @@ | |
$compareType = Get-VstsInput -Name compareType -Require | ||
$buildNumber = Get-VstsInput -Name buildNumber | ||
$overwritePkgArtifact = ((Get-VstsInput -Name overwriteExistingPkgArtifact) -eq "true") | ||
$pkgArtifactPath = Get-VstsInput -Name pkgArtifactPath -Require | ||
if (-not $pkgArtifactPath.EndsWith('\')) | ||
{ | ||
$pkgArtifactPath = $pkgArtifactPath + '\' | ||
} | ||
|
||
try | ||
{ | ||
|
@@ -57,20 +62,26 @@ | |
|
||
Write-Host (Get-VstsLocString -Key SearchingApplicationType -ArgumentList $appTypeName) | ||
|
||
$oldAppPackagePath = Join-Path $oldDropLocation $newAppPackagePath.SubString((Get-VstsTaskVariable -Name Build.SourcesDirectory -Require).Length + 1) | ||
if (-not $newAppPackagePath.StartsWith($pkgArtifactPath)) | ||
{ | ||
Write-Error (Get-VstsLocString -Key PackageIsNotUnderArtifact -ArgumentList @($newAppPackagePath, $pkgArtifactPath)) | ||
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. No need to return? 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. Write-Error effectively throws an exception an halts execution |
||
} | ||
$relativePath = $newAppPackagePath.SubString($pkgArtifactPath.Length) | ||
|
||
$oldAppPackagePath = Join-Path $oldDropLocation $relativePath | ||
$oldAppManifestPath = Join-Path $oldAppPackagePath $appManifestName | ||
if (Test-Path $oldAppManifestPath) | ||
{ | ||
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. Would be good to have UTs for this non-trivial logic |
||
$oldAppManifestXml = [XML](Get-Content $oldAppManifestPath) | ||
|
||
# Set the version to the version from the previous build (including its suffix). This will be overwritten if we find any changes, otherwise it will match the previous build by design. | ||
# Set it before we search for changes so that we can compare the xml without the old version suffix causing a false positive. | ||
# Set it before we search for changes so that we can compare the xml without the old version suffix causing a false positive. | ||
$newAppManifestXml.ApplicationManifest.ApplicationTypeVersion = $oldAppManifestXml.ApplicationManifest.ApplicationTypeVersion | ||
} | ||
else | ||
{ | ||
Write-Warning (Get-VstsLocString -Key NoManifestInPreviousBuild) | ||
$updateAllVersions = $true | ||
$updateAllVersions = $true | ||
} | ||
} | ||
else | ||
|
@@ -85,7 +96,7 @@ | |
$logIndent = "".PadLeft(2) | ||
foreach ($serviceManifestImport in $newAppManifestXml.ApplicationManifest.ServiceManifestImport) | ||
{ | ||
$serviceVersion = Update-ServiceVersions -VersionValue $versionValue -ServiceName $serviceManifestImport.ServiceManifestRef.ServiceManifestName -NewPackageRoot $newAppPackagePath -OldPackageRoot $oldAppPackagePath -LogIndent $logIndent -UpdateAllVersions:$updateAllVersions -LogAllChanges:$logAllChanges -ReplaceVersion:$replaceVersion | ||
$serviceVersion = Update-ServiceVersions -VersionValue $versionValue -ServiceName $serviceManifestImport.ServiceManifestRef.ServiceManifestName -NewPackageRoot $newAppPackagePath -OldPackageRoot $oldAppPackagePath -LogIndent $logIndent -UpdateAllVersions:$updateAllVersions -LogAllChanges:$logAllChanges -ReplaceVersion:$replaceVersion | ||
$serviceManifestImport.ServiceManifestRef.ServiceManifestVersion = $serviceVersion | ||
} | ||
|
||
|
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.
It is very difficult to make user understand about this new mandatory input. Can we think of any alternative without additional input. Can we parse $newAppPackagePath to check if it contains a path fragment which matches path inside $oldPackagePath. For example, if new path is C:\a\b\c\ApplicationPackage.xml then we can iterate whether old package contains any of following path: