From 6a37cdcf6401522213af3e4dab4581a2d4b10161 Mon Sep 17 00:00:00 2001 From: Ahmet Ibrahim Aksoy Date: Fri, 16 Aug 2024 15:17:53 +0200 Subject: [PATCH] Fix Time64Distro Packaging on GH Actions (#4463) --- .azure/OneBranch.Official.yml | 9 ++++++++ .azure/OneBranch.PullRequest.yml | 8 +++++++ .azure/obtemplates/build-linux-packages.yml | 23 +++++++++------------ .github/workflows/package-linux.yml | 7 ++++--- .github/workflows/package-reuse-linux.yml | 6 +++++- scripts/package-distribution.ps1 | 7 +++++-- 6 files changed, 41 insertions(+), 19 deletions(-) diff --git a/.azure/OneBranch.Official.yml b/.azure/OneBranch.Official.yml index 80de7ea1e9..520dfcf7f8 100644 --- a/.azure/OneBranch.Official.yml +++ b/.azure/OneBranch.Official.yml @@ -207,6 +207,15 @@ extends: - template: .azure/obtemplates/build-linux-packages.yml@self parameters: sign: true + kernel: "kernel5_4" + - template: .azure/obtemplates/build-linux-packages.yml@self + parameters: + sign: true + kernel: "kernel5_15" + - template: .azure/obtemplates/build-linux-packages.yml@self + parameters: + sign: true + kernel: "kernel6_8" - stage: package_windows displayName: Package Windows diff --git a/.azure/OneBranch.PullRequest.yml b/.azure/OneBranch.PullRequest.yml index 99b0116496..1b873524c9 100644 --- a/.azure/OneBranch.PullRequest.yml +++ b/.azure/OneBranch.PullRequest.yml @@ -201,6 +201,14 @@ extends: - build_linux jobs: - template: .azure/obtemplates/build-linux-packages.yml@self + parameters: + kernel: "kernel5_4" + - template: .azure/obtemplates/build-linux-packages.yml@self + parameters: + kernel: "kernel5_15" + - template: .azure/obtemplates/build-linux-packages.yml@self + parameters: + kernel: "kernel6_8" - stage: package_windows displayName: Package Windows diff --git a/.azure/obtemplates/build-linux-packages.yml b/.azure/obtemplates/build-linux-packages.yml index d23327603f..bf8dbf69be 100644 --- a/.azure/obtemplates/build-linux-packages.yml +++ b/.azure/obtemplates/build-linux-packages.yml @@ -1,22 +1,17 @@ parameters: - sign: false +- name: sign + type: boolean + default: false +- name: kernel + type: string jobs: -- job: distribution +- job: distribution_${{ parameters.kernel }} # artifact becomes drop_package_linux_${{ jobname }} displayName: Distribution - strategy: - matrix: - ubuntu_2004: - kernel: "kernel5_4" - ubuntu_2204: - kernel: "kernel5_15" - ubuntu_2404: - kernel: "kernel6_8" pool: type: linux variables: ob_outputDirectory: $(Build.SourcesDirectory)/artifacts/dist - ob_artifactSuffix: _$(kernel) # drop_package_linux_${{ jobname }}_${{ kernel }} steps: - task: PowerShell@2 displayName: Prepare Build Machine @@ -26,12 +21,12 @@ jobs: arguments: -ForContainerBuild - task: DownloadPipelineArtifact@2 inputs: - artifact: drop_build_linux_$(kernel)_Debug + artifact: drop_build_linux_${{ parameters.kernel }}_Debug path: $(Build.SourcesDirectory)/artifacts/bin/linux pattern: '*.tar' - task: DownloadPipelineArtifact@2 inputs: - artifact: drop_build_linux_$(kernel)_Release + artifact: drop_build_linux_${{ parameters.kernel }}_Release path: $(Build.SourcesDirectory)/artifacts/bin/linux pattern: '*.tar' - script: | # rebuild artifacts with correct permissions and symlink attributes. @@ -43,6 +38,8 @@ jobs: inputs: pwsh: false filePath: scripts/package-distribution.ps1 + ${{ if eq(parameters.kernel, 'kernel6_8') }}: + arguments: -Time64Distro - script: | # prepare 2 sets of packages for signing with different keys (gen = general purpose, cbl = cbl-mariner) mkdir $(Build.SourcesDirectory)/artifacts/dist/gen find $(Build.SourcesDirectory)/artifacts/dist -type f -exec mv -t $(Build.SourcesDirectory)/artifacts/dist/gen/ {} + diff --git a/.github/workflows/package-linux.yml b/.github/workflows/package-linux.yml index 7b07fff506..632b0578e9 100644 --- a/.github/workflows/package-linux.yml +++ b/.github/workflows/package-linux.yml @@ -33,9 +33,9 @@ jobs: { config: "Release", os: "ubuntu-22.04", arch: "arm", tls: "openssl3" }, { config: "Release", os: "ubuntu-22.04", arch: "arm64", tls: "openssl3" }, { config: "Release", os: "ubuntu-22.04", arch: "x64", tls: "openssl3" }, - { config: "Release", os: "ubuntu-24.04", arch: "arm", tls: "openssl3" }, - { config: "Release", os: "ubuntu-24.04", arch: "arm64", tls: "openssl3" }, - { config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", xdp: "-UseXdp" }, + { config: "Release", os: "ubuntu-24.04", arch: "arm", tls: "openssl3", time64: "-Time64Distro" }, + { config: "Release", os: "ubuntu-24.04", arch: "arm64", tls: "openssl3", time64: "-Time64Distro" }, + { config: "Release", os: "ubuntu-24.04", arch: "x64", tls: "openssl3", xdp: "-UseXdp", time64: "-Time64Distro" }, ] uses: ./.github/workflows/package-reuse-linux.yml with: @@ -44,6 +44,7 @@ jobs: arch: ${{ matrix.vec.arch }} tls: ${{ matrix.vec.tls }} xdp: ${{ matrix.vec.xdp }} + time64: ${{ matrix.vec.time64 }} test-packages: name: Test Linux Packages diff --git a/.github/workflows/package-reuse-linux.yml b/.github/workflows/package-reuse-linux.yml index 8ff4ab2ec1..2723b3052f 100644 --- a/.github/workflows/package-reuse-linux.yml +++ b/.github/workflows/package-reuse-linux.yml @@ -54,6 +54,10 @@ on: required: false default: '' type: string + time64: + required: false + default: '' + type: string permissions: read-all @@ -96,7 +100,7 @@ jobs: find -name "*.tar" -exec tar -xvf '{}' \; - name: Build Package shell: pwsh - run: scripts/package-distribution.ps1 -OS ${{ inputs.os }} + run: scripts/package-distribution.ps1 ${{ inputs.time64 }} - name: Upload build artifacts uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: diff --git a/scripts/package-distribution.ps1 b/scripts/package-distribution.ps1 index e3dc4c5d26..842650a4de 100644 --- a/scripts/package-distribution.ps1 +++ b/scripts/package-distribution.ps1 @@ -6,6 +6,11 @@ #> +param ( + [Parameter(Mandatory = $false)] + [switch]$Time64Distro = $false +) + Set-StrictMode -Version 'Latest' $PSDefaultParameterValues['*:ErrorAction'] = 'Stop' @@ -116,13 +121,11 @@ foreach ($Build in $AllBuilds) { } # if datapath_raw_xdp_kern.o exists under $ArtifactsDir, $UseXdp to be true - $Time64Distro = $false $UseXdp = $false if ($Platform -eq "linux") { $XdpBin = Join-Path $ArtifactsDir "datapath_raw_xdp_kern.o" if (Test-Path $XdpBin) { $UseXdp = $true - $Time64Distro = $true } }