Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ resources:
queue:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TravisEz13, your last commit had 1 failures in PowerShell-CI-windows
Enter-PSHostProcess tests.By CustomPipeName.Can enter, exit, and re-enter using CustomPipeName

Expected $true, because The script was able to re-enter another process and grab the pipe of 'jedexcup.cgd'., but got $false.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\Microsoft.PowerShell.Core\Enter-PSHostProcess.Tests.ps1: line 208
208:                     Should -BeTrue -Because "The script was able to re-enter another process and grab the pipe of '$pipeName'."

name: Hosted VS2017
steps:
- powershell: |
- pwsh: |
Install-Module -Name PowerShellGet -MinimumVersion 2.0.1 -Force
Import-Module PowerShellGet -Force -Verbose
displayName: Update PSGet and PackageManagement
condition: succeededOrFailed()

- powershell: |
- pwsh: |
Import-Module -Force "$(Build.SourcesDirectory)/tools/releaseBuild/azureDevOps/AzArtifactFeed/SyncGalleryToAzArtifacts.psm1"
SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT) -Destination $(Build.ArtifactStagingDirectory)
displayName: Download packages from PSGallery that need to be updated
condition: succeededOrFailed()

- powershell: |
- pwsh: |
Write-Verbose -Verbose "Packages to upload"
if(Test-Path $(Build.ArtifactStagingDirectory)) { Get-ChildItem "$(Build.ArtifactStagingDirectory)/*.nupkg" | ForEach-Object { $_.FullName }}
displayName: List packages to upload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ function SyncGalleryToAzArtifacts {
}

# Check if Az package version is less that gallery version
if ($foundPackageOnAz.Version -lt $foundPackageOnGallery.Version) {
if (CompareVersions -lt -ReferencePackage $foundPackageOnAz -DifferencePackage $foundPackageOnGallery) {
Write-Verbose -Verbose "Module needs to be updated $($package.Name) - $($foundPackageOnGallery.Version)"
$modulesToUpdate += $foundPackageOnGallery
} elseif ($foundPackageOnGallery.Version -lt $foundPackageOnAz.Version) {
} elseif (CompareVersions -lt -ReferencePackage $foundPackageOnGallery -DifferencePackage $foundPackageOnAz) {
Write-Warning "Newer version found on Az Artifacts - $($foundPackageOnAz.Name) - $($foundPackageOnAz.Version)"
} else {
Write-Verbose -Verbose "Module is in sync - $($package.Name)"
Expand All @@ -92,7 +92,7 @@ function SyncGalleryToAzArtifacts {

# Remove dependent packages downloaded by Save-Module if there are already present in AzArtifacts feed.
try {
Register-PackageSource -Name local -Location $Destination -ProviderName NuGet -Force
$null = Register-PackageSource -Name local -Location $Destination -ProviderName NuGet -Force
$packageNamesToKeep = @()
$savedPackages = Find-Package -Source local -AllVersions -AllowPreReleaseVersion

Expand Down Expand Up @@ -120,6 +120,34 @@ function SyncGalleryToAzArtifacts {

}

Function CompareVersions {
param (
[Microsoft.PackageManagement.Packaging.SoftwareIdentity]
$ReferencePackage,
[Microsoft.PackageManagement.Packaging.SoftwareIdentity]
$DifferencePackage,
[Parameter(Mandatory = $true, ParameterSetName='lt')]
[switch]
$lt,
[Parameter(Mandatory = $true, ParameterSetName='gt')]
[switch]
$gt
)

if ($ReferencePackage.Version -eq $DifferencePackage.Version) {
return $false
}

$latest = SortPackage -p @($ReferencePackage,$DifferencePackage) | Select-Object -First 1

if ($gt.IsPresent) {
return $ReferencePackage -eq $latest
} elseif ($lt.IsPresent) {
return $DifferencePackage -eq $latest
} else {
throw "Unknown parameter set"
}
}


Function SortPackage {
Expand Down Expand Up @@ -176,4 +204,4 @@ function NormalizeVersion {
$sVer
}

Export-ModuleMember -Function 'SyncGalleryToAzArtifacts'
Export-ModuleMember -Function 'SyncGalleryToAzArtifacts', 'SortPackage'