Skip to content

Commit fe6d172

Browse files
committed
ubuntu24.04 ci pipeline fix
Signed-off-by: shiva kumar <[email protected]>
1 parent 63b47cb commit fe6d172

File tree

3 files changed

+99
-8
lines changed

3 files changed

+99
-8
lines changed

.github/workflows/precompiled.yaml

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,14 @@ jobs:
154154
name: driver-images-${{ matrix.driver_branch }}-${{ env.KERNEL_VERSION }}-${{ env.DIST }}
155155
path: ./driver-images-${{ matrix.driver_branch }}-${{ env.KERNEL_VERSION }}-${{ env.DIST }}.tar
156156
retention-days: 1
157-
157+
158+
- name: Upload kernel version as an artifact
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: kernel-version-${{ matrix.driver_branch }}-${{ env.KERNEL_VERSION }}-${{ env.DIST }}
162+
path: ./kernel-version-${{ matrix.driver_branch }}-${{ env.KERNEL_VERSION }}-${{ env.DIST }}.txt
163+
retention-days: 1
164+
158165
determine-e2e-test-matrix:
159166
runs-on: linux-amd64-cpu4
160167
strategy:
@@ -210,6 +217,80 @@ jobs:
210217
echo "matrix_values=$(cat $GITHUB_WORKSPACE/matrix_values.json | jq -c .)" >> $GITHUB_OUTPUT
211218
echo "matrix_values_not_empty=1" >> $GITHUB_OUTPUT
212219
220+
determine-e2e-test-matrix-first-release:
221+
runs-on: linux-amd64-cpu4
222+
if: ${{ needs.determine-e2e-test-matrix.outputs.matrix_values_not_empty == '0' }}
223+
strategy:
224+
matrix:
225+
dist: ${{ fromJson(needs.set-driver-version-matrix.outputs.dist) }}
226+
needs:
227+
- precompiled-build-image
228+
- set-driver-version-matrix
229+
outputs:
230+
matrix_values_not_empty: ${{ steps.set_kernel_version.outputs.matrix_values_not_empty }}
231+
matrix_values: ${{ steps.set_kernel_version.outputs.matrix_values }}
232+
dist: ${{ steps.set-driver-version-matrix.outputs.dist }}
233+
steps:
234+
- name: Check out code
235+
uses: actions/checkout@v4
236+
- name: Login to GitHub Container Registry
237+
uses: docker/login-action@v3
238+
with:
239+
registry: ghcr.io
240+
username: ${{ github.actor }}
241+
password: ${{ secrets.GITHUB_TOKEN }}
242+
243+
# download kernel version file for first release
244+
- name: Download kernel version artifact
245+
uses: actions/download-artifact@v4
246+
with:
247+
name: kernel-version-${{ matrix.driver_branch }}-${{ matrix.kernel_version }}-${{ matrix.dist }}
248+
path: ./
249+
250+
# download kernel version file for first release
251+
- name: Download kernel version artifact
252+
env:
253+
DIST: ${{ matrix.dist }}
254+
run: |
255+
artifacts=$(gh api -X GET /repos/${{ github.repository }}/actions/artifacts --jq '.artifacts[] | select(.name | endswith(env.DIST)) | .name')
256+
for artifact in $artifacts; do
257+
echo "Downloading kernel_version: $artifact"
258+
gh run download --name "$artifact" --dir ./
259+
done
260+
261+
- name: Set kernel version
262+
id: set_kernel_version
263+
env:
264+
DIST: ${{ matrix.dist }}
265+
run: |
266+
echo "matrix_values_not_empty=0" >> $GITHUB_OUTPUT
267+
268+
if [ "$DIST" == "ubuntu22.04" ]; then
269+
export BASE_TARGET="jammy"
270+
export LTS_KERNEL="5.15"
271+
elif [ "$DIST" == "ubuntu24.04" ]; then
272+
export BASE_TARGET="noble"
273+
export LTS_KERNEL="6.8"
274+
fi
275+
276+
kernel_flavors_json='${{ needs.set-driver-version-matrix.outputs.kernel_flavors }}'
277+
KERNEL_FLAVORS=($(echo "$kernel_flavors_json" | jq -r '.[]'))
278+
driver_branch_json='${{ needs.set-driver-version-matrix.outputs.driver_branch }}'
279+
DRIVER_BRANCHES=($(echo "$driver_branch_json" | jq -r '.[]'))
280+
281+
source ./tests/scripts/ci-precompiled-helpers.sh
282+
KERNEL_VERSIONS=($(get_kernel_versions_to_test $BASE_TARGET KERNEL_FLAVORS[@] DRIVER_BRANCHES[@] $DIST))
283+
if [ -z "$KERNEL_VERSIONS" ]; then
284+
# no new kernel release
285+
echo "Skipping e2e tests"
286+
exit 0
287+
fi
288+
# Convert array to JSON format and assign
289+
echo "[]" > $GITHUB_WORKSPACE/matrix_values.json
290+
printf '%s\n' "${KERNEL_VERSIONS[@]}" | jq -R . | jq -s . > $GITHUB_WORKSPACE/matrix_values.json
291+
echo "matrix_values=$(cat $GITHUB_WORKSPACE/matrix_values.json | jq -c .)" >> $GITHUB_OUTPUT
292+
echo "matrix_values_not_empty=1" >> $GITHUB_OUTPUT
293+
213294
e2e-tests-nvidiadriver:
214295
runs-on: linux-amd64-cpu4
215296
needs:
@@ -260,6 +341,14 @@ jobs:
260341
DRIVER_BRANCHES=($(echo "$driver_branch_json" | jq -r '.[]'))
261342
echo "DRIVER_BRANCHES=${DRIVER_BRANCHES[*]}" >> $GITHUB_ENV
262343
344+
# step added to skip azure e2e tests and publish the image
345+
# FIXME -- remove step once azure kernel upgrade starts working
346+
- name: Skip azure e2e
347+
if [[ "${KERNEL_VERSION}" == *-azure ]]; then
348+
echo "e2e test for azure flavor skipped, as kernel upgrade AWS => azure is not supported"
349+
exit 0
350+
fi
351+
263352
- name: Install GitHub CLI
264353
run: |
265354
sudo apt-get update

tests/scripts/ci-precompiled-helpers.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@ get_kernel_versions_to_test() {
1111

1212
kernel_versions=()
1313
for kernel_flavor in "${KERNEL_FLAVORS[@]}"; do
14-
# FIXME -- remove if condition, once azure kernel upgrade starts working
15-
if [[ "$kernel_flavor" == "azure" ]]; then
16-
continue
17-
fi
1814
for DRIVER_BRANCH in "${DRIVER_BRANCHES[@]}"; do
1915
source ./tests/scripts/findkernelversion.sh "$BASE_TARGET" "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" >&2
20-
if [[ "$should_continue" == true ]]; then
16+
if [[ "$should_continue" == true || "$should_continue_first_release" == true ]]; then
2117
break
2218
fi
2319
done
2420
if [[ "$should_continue" == true ]]; then
2521
KERNEL_VERSION=$(echo "$KERNEL_VERSION" | tr -d ' \n')
2622
kernel_versions+=("$KERNEL_VERSION")
2723
fi
24+
if [[ "$should_continue_first_release" == true ]]; then
25+
matching_kernel_version_file=$(ls | grep "$DRIVER_BRANCHES" | grep "$LTS_KERNEL" | grep "$KERNEL_FLAVORS" | grep "$DIST")
26+
source $matching_kernel_version_file
27+
KERNEL_VERSION=$(echo "$KERNEL_VERSION" | tr -d ' \n')
28+
kernel_versions+=("$KERNEL_VERSION")
29+
fi
2830
done
2931
echo "${kernel_versions[@]}"
3032
}

tests/scripts/findkernelversion.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export PATH=$(pwd)/bin:${PATH}
2020
regctl image get-file ghcr.io/nvidia/driver:base-${BASE_TARGET}-${KERNEL_FLAVOR}-${DRIVER_BRANCH} /var/kernel_version.txt ./kernel_version.txt
2121
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
2222
# first release KERNEL_VERSIONS is null
23+
export should_continue_first_release=false
2324
if [ -z "$KERNEL_VERSIONS" ]; then
24-
regctl image get-file nvcr.io/nvidia/driver:base-${BASE_TARGET}-${KERNEL_FLAVOR}-${DRIVER_BRANCH} /var/kernel_version.txt ./kernel_version.txt
25-
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
25+
export should_continue_first_release=true
2626
fi
2727

2828
# calculate driver tag

0 commit comments

Comments
 (0)