Skip to content

Commit b4f8990

Browse files
committed
keep supporting ltsc2019 for builds
1 parent e548bc8 commit b4f8990

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

.github/workflows/build-windows-integration-test.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
workflow_dispatch:
1111
workflow_call:
1212
inputs:
13+
only_this_windows_version_tag:
14+
description: (ltsc2019 or ltsc2022) Specify the Windows version to build. Leave blank for both 2019 and 2022.
15+
type: string
16+
required: false
1317
scenario_tag:
1418
description: Tag for the scenario being tested
1519
type: string
@@ -29,9 +33,34 @@ permissions:
2933
security-events: write
3034

3135
jobs:
36+
generate-matrix:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
matrix: ${{ steps.set-matrix.outputs.matrix }}
40+
steps:
41+
- id: set-matrix
42+
run: |
43+
if [[ -n "${{ inputs.only_this_windows_version_tag }}" ]]; then
44+
tag="${{ inputs.only_this_windows_version_tag }}"
45+
last4="${tag: -4}"
46+
echo "Last 4 digits of tag: $last4"
47+
fi
48+
49+
if [[ -z "${{ inputs.only_this_windows_version_tag }}" ]]; then
50+
echo "matrix={\"windows\":[{\"runner\":\"windows-x64-8-core\",\"tag\":\"ltsc2019\"},{\"runner\":\"windows-x64-8-core\",\"tag\":\"ltsc2022\"}]}" >> $GITHUB_OUTPUT
51+
else
52+
echo "matrix={\"windows\":[{\"runner\":\"windows-x64-8-core\",\"tag\":\"${{ inputs.only_this_windows_version_tag }}\"}]}" >> $GITHUB_OUTPUT
53+
fi
54+
55+
echo "Final matrix: $(cat $GITHUB_OUTPUT)"
56+
3257
build:
3358
name: Build integration for
34-
runs-on: windows-x64-8-core
59+
needs: generate-matrix
60+
strategy:
61+
fail-fast: true
62+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
63+
runs-on: ${{ matrix.windows.runner }}
3564
steps:
3665
- uses: actions/checkout@v7
3766
- uses: actions/setup-go@v6
@@ -53,7 +82,7 @@ jobs:
5382
COMMIT: ${{ github.sha }}
5483
DATE: ${{ needs.build-env-args.outputs.date }}
5584
TAG: "e2e-testing-${{ github.sha }}"
56-
WIN_VERSION: ltsc2022
85+
WIN_VERSION: ${{ matrix.windows.tag }}
5786
WIN_DIR: 'windows/nri-kubernetes'
5887
run: |
5988
$scriptPath = Join-Path $env:WIN_DIR "build.ps1"
@@ -63,6 +92,7 @@ jobs:
6392
shell: powershell
6493
env:
6594
COMMIT: ${{ github.sha }}
95+
MATRIX_TAG: ${{ matrix.windows.tag }}
6696
WIN_DIR: 'windows/nri-kubernetes'
6797
SCENARIO_TAG: ${{ inputs.scenario_tag }}
6898
run: |
@@ -71,14 +101,14 @@ jobs:
71101
Write-Output "Using scenario tag: $env:tag"
72102
}
73103
74-
$env:DOCKER_TAG = "windows-ltsc2022-e2e-testing-$env:tag"
104+
$env:DOCKER_TAG = "windows-${{ matrix.windows.tag }}-e2e-testing-$env:tag"
75105
echo "DOCKER_TAG=$env:DOCKER_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append
76106
77107
$dockerfilePath = Join-Path $env:WIN_DIR "Dockerfile.windows"
78108
79109
ls
80110
docker build --platform windows/amd64 -f $dockerfilePath `
81-
--build-arg BASE_IMAGE_TAG=ltsc2022 `
111+
--build-arg BASE_IMAGE_TAG=${{ matrix.windows.tag }} `
82112
--build-arg "COMMIT=${env:COMMIT}" `
83113
--build-arg "DATE=${env:DATE}" `
84114
--build-arg "TAG=$env:DOCKER_TAG" `
@@ -113,7 +143,7 @@ jobs:
113143
uses: github/codeql-action/upload-sarif@v4
114144
with:
115145
sarif_file: 'trivy-results.sarif'
116-
category: 'trivy-windows-ltsc2022'
146+
category: 'trivy-windows-${{ matrix.windows.tag }}'
117147

118148
- name: Output pushed image tag
119149
shell: powershell

0 commit comments

Comments
 (0)