-
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
Merged
NCarlsonMSFT
merged 3 commits into
master
from
users/ncarlson/SupportNotStagingDirectory
Mar 15, 2018
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Tasks/ServiceFabricUpdateManifests/Tests/Update-ApplicationVersions.NoChanges.SubPath.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[CmdletBinding()] | ||
param() | ||
|
||
. "$PSScriptRoot\Test-ApplicationVersions.ps1" PreviousPkg -PackageSubPath "Foo\Bar\" |
4 changes: 4 additions & 0 deletions
4
.../ServiceFabricUpdateManifests/Tests/Update-ApplicationVersions.ServiceChanged.SubPath.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[CmdletBinding()] | ||
param() | ||
|
||
. "$PSScriptRoot\Test-ApplicationVersions.ps1" PreviousPkg -Service1Changed -PackageSubPath "Foo\Bar\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,20 +57,45 @@ | |
|
||
Write-Host (Get-VstsLocString -Key SearchingApplicationType -ArgumentList $appTypeName) | ||
|
||
$oldAppPackagePath = Join-Path $oldDropLocation $newAppPackagePath.SubString((Get-VstsTaskVariable -Name Build.SourcesDirectory -Require).Length + 1) | ||
$oldAppManifestPath = Join-Path $oldAppPackagePath $appManifestName | ||
if (Test-Path $oldAppManifestPath) | ||
# Try and find the old app package path by finding the largest substring of the path that exists in the artifact path | ||
$relativePath = $newAppPackagePath | ||
$pathRoot = [System.IO.Path]::GetPathRoot($relativePath) | ||
if(![System.String]::IsNullOrEmpty($pathRoot)) | ||
{ | ||
$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. | ||
$newAppManifestXml.ApplicationManifest.ApplicationTypeVersion = $oldAppManifestXml.ApplicationManifest.ApplicationTypeVersion | ||
$relativePath = $relativePath.SubString($pathRoot.Length) | ||
} | ||
$relativePath.Trim([System.IO.Path]::DirectorySeparatorChar) | ||
$oldAppPackagePath = Join-Path $oldDropLocation $relativePath | ||
while(!(Test-Path $oldAppPackagePath)) | ||
{ | ||
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 |
||
$firstSlash = $relativePath.IndexOf([System.IO.Path]::DirectorySeparatorChar) | ||
if ($firstSlash -lt 0) | ||
{ | ||
Write-Warning (Get-VstsLocString -Key CouldNotFindSubPath -ArgumentList @($newAppPackagePath, $oldDropLocation)) | ||
$updateAllVersions = $true | ||
$oldAppPackagePath = $null | ||
break; | ||
} | ||
$relativePath = $relativePath.SubString($firstSlash + 1) | ||
$oldAppPackagePath = Join-Path $oldDropLocation $relativePath | ||
} | ||
else | ||
|
||
if ($oldAppPackagePath) | ||
{ | ||
Write-Warning (Get-VstsLocString -Key NoManifestInPreviousBuild) | ||
$updateAllVersions = $true | ||
$oldAppManifestPath = Join-Path $oldAppPackagePath $appManifestName | ||
if (Test-Path $oldAppManifestPath) | ||
{ | ||
$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. | ||
$newAppManifestXml.ApplicationManifest.ApplicationTypeVersion = $oldAppManifestXml.ApplicationManifest.ApplicationTypeVersion | ||
} | ||
else | ||
{ | ||
Write-Warning (Get-VstsLocString -Key NoManifestInPreviousBuild) | ||
$updateAllVersions = $true | ||
} | ||
} | ||
} | ||
else | ||
|
@@ -85,7 +110,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 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't we start with Build.SourcesDirectory directory rather than root?
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.
Generally this would actually be under Build.StagingDirectory, but there is no guarantee of that.
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.
got it