Skip to content
Open
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
30 changes: 30 additions & 0 deletions .azdo/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,36 @@ pr:
- latestw_all

stages:
- stage: BuildDependencies
displayName: Build Dependencies
jobs:
- job: InstallDeps_x64
displayName: Install vcpkg Dependencies (x64)
pool:
name: PS-PowerShell-x64
demands:
- ImageOverride -equals PSMMS2022-OpenSSH-Secure
steps:
- template: ./templates/install-vcpkg-dependencies.yml
parameters:
triplet: x64-custom
artifactSuffix: x64

- job: InstallDeps_x86
displayName: Install vcpkg Dependencies (x86)
pool:
name: PS-PowerShell-x64
demands:
- ImageOverride -equals PSMMS2022-OpenSSH-Secure
steps:
- template: ./templates/install-vcpkg-dependencies.yml
parameters:
triplet: x86-custom
artifactSuffix: x86

- stage: Build
displayName: Build Win32-OpenSSH
dependsOn: BuildDependencies
jobs:
- job: BuildPkg_x64
displayName: Build Package (x64)
Expand All @@ -26,6 +54,7 @@ stages:
nativeHostArch: x64
buildOutputDir: x64
artifactSuffix: x64
dependenciesArtifactName: vcpkg-dependencies-x64
includeConfig: true

- job: BuildPkg_x86
Expand All @@ -40,6 +69,7 @@ stages:
nativeHostArch: x86
buildOutputDir: Win32
artifactSuffix: x86
dependenciesArtifactName: vcpkg-dependencies-x86

- stage: Test
displayName: Test Win32-OpenSSH
Expand Down
31 changes: 11 additions & 20 deletions .azdo/templates/build-win32-openssh-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,27 @@ parameters:
type: string
- name: artifactSuffix
type: string
- name: dependenciesArtifactName
type: string
- name: includeConfig
type: boolean
default: false

steps:
- pwsh: |
# Compare LibreSSL versions in vcpkg.json and add-resource-file.patch
$vcpkgObj = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg.json" | ConvertFrom-Json
$libresslVersionJson = $vcpkgObj | Select-Object -ExpandProperty overrides | Where-Object { $_.name -eq 'libressl' } | Select-Object -ExpandProperty version

# resource file version needs to be trimmed (e.g. 4.0.0.0 to 4.0.0)
$patchContent = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_overlay_ports/libressl/add-version-file.patch"
$libresslVersionPatch = ($patchContent -join "`n" | Select-String -Pattern '"FileVersion",\s*"(\d+\.\d+\.\d+\.\d+)"' -AllMatches).Matches | ForEach-Object { $_.Groups[1].Value }
$libresslVersionPatchParts = $libresslVersionPatch -split '\.'
$libresslVersionPatchShort = ($libresslVersionPatchParts[0..2] -join '.')

if ($libresslVersionJson -ne $libresslVersionPatchShort) {
Write-Error "LibreSSL version mismatch: vcpkg.json has $libresslVersionJson, patch file has $libresslVersionPatch"
exit 1
} else {
Write-Verbose -Verbose "LibreSSL versions match: $libresslVersionJson"
}
displayName: 'Verify version info'

- pwsh: |-
$ErrorActionPreference = 'Stop'
git clone https://github.com/microsoft/vcpkg
cd vcpkg
& ./bootstrap-vcpkg.bat
& ./vcpkg.exe integrate install
displayName: Install vcpkg
displayName: Install and bootstrap vcpkg

- task: DownloadPipelineArtifact@2
displayName: 'Download vcpkg dependencies (${{ parameters.dependenciesArtifactName }})'
inputs:
buildType: current
artifactName: ${{ parameters.dependenciesArtifactName }}
targetPath: '$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_installed'

- pwsh: |
$nativeArch = '${{ parameters.nativeHostArch }}'
Expand Down
66 changes: 66 additions & 0 deletions .azdo/templates/install-vcpkg-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
parameters:
- name: triplet
type: string
- name: artifactSuffix
type: string

steps:
- pwsh: |
# Compare LibreSSL versions in vcpkg.json and add-resource-file.patch
$vcpkgObj = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg.json" | ConvertFrom-Json
$libresslVersionJson = $vcpkgObj | Select-Object -ExpandProperty overrides | Where-Object { $_.name -eq 'libressl' } | Select-Object -ExpandProperty version

# resource file version needs to be trimmed (e.g. 4.0.0.0 to 4.0.0)
$patchContent = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_overlay_ports/libressl/add-version-file.patch"
$libresslVersionPatch = ($patchContent -join "`n" | Select-String -Pattern '"FileVersion",\s*"(\d+\.\d+\.\d+\.\d+)"' -AllMatches).Matches | ForEach-Object { $_.Groups[1].Value }
$libresslVersionPatchParts = $libresslVersionPatch -split '\.'
$libresslVersionPatchShort = ($libresslVersionPatchParts[0..2] -join '.')

if ($libresslVersionJson -ne $libresslVersionPatchShort) {
Write-Error "LibreSSL version mismatch: vcpkg.json has $libresslVersionJson, patch file has $libresslVersionPatch"
exit 1
} else {
Write-Verbose -Verbose "LibreSSL versions match: $libresslVersionJson"
}
displayName: 'Verify version info'

- pwsh: |
$ErrorActionPreference = 'Stop'
git clone https://github.com/microsoft/vcpkg
cd vcpkg
& ./bootstrap-vcpkg.bat
& ./vcpkg.exe integrate install
displayName: Install and bootstrap vcpkg

- pwsh: |
$triplet = '${{ parameters.triplet }}'
Write-Verbose -Verbose "Installing vcpkg dependencies for triplet: $triplet"

Push-Location "$(Build.SourcesDirectory)/contrib/win32/openssh"
try {
& "$(Build.SourcesDirectory)/vcpkg/vcpkg.exe" install --triplet $triplet --overlay-triplets=.\vcpkg_triplets --overlay-ports=.\vcpkg_overlay_ports
if ($LASTEXITCODE -ne 0) {
throw "vcpkg install failed with exit code $LASTEXITCODE"
}
} finally {
Pop-Location
}
displayName: Install vcpkg dependencies (${{ parameters.triplet }})

- pwsh: |
$artifactSuffix = '${{ parameters.artifactSuffix }}'
$vcpkgInstalledPath = "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_installed"

if (Test-Path -Path $vcpkgInstalledPath) {
Write-Verbose -Verbose "vcpkg_installed directory contents:"
Get-ChildItem -Path $vcpkgInstalledPath -Recurse -Depth 2 | Select-Object -First 50

# Upload vcpkg dependencies artifact
Write-Verbose -Verbose -Message "Uploading vcpkg dependencies artifact"
$artifactName = "vcpkg-dependencies-$artifactSuffix"
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$vcpkgInstalledPath"
} else {
Write-Error "vcpkg_installed directory not found at: $vcpkgInstalledPath"
exit 1
}
displayName: Upload vcpkg dependencies (${{ parameters.artifactSuffix }})