Skip to content

Commit 3552903

Browse files
authored
Merge pull request #249 from NVIDIA/kernelversionfix
Precompile kernel version fix for multiple base target
2 parents 1436b48 + 0d15237 commit 3552903

File tree

3 files changed

+26
-36
lines changed

3 files changed

+26
-36
lines changed

.github/workflows/precompiled.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
done))
200200
fi
201201
source ./tests/scripts/ci-precompiled-helpers.sh
202-
KERNEL_VERSIONS=($(get_kernel_versions_to_test $BASE_TARGET KERNEL_FLAVORS[@] DRIVER_BRANCHES[@] $DIST))
202+
KERNEL_VERSIONS=($(get_kernel_versions_to_test KERNEL_FLAVORS[@] DRIVER_BRANCHES[@] $DIST $LTS_KERNEL))
203203
if [ -z "$KERNEL_VERSIONS" ]; then
204204
# no new kernel release
205205
echo "Skipping e2e tests"

tests/scripts/ci-precompiled-helpers.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
get_kernel_versions_to_test() {
22
if [[ "$#" -ne 4 ]]; then
3-
echo " Error:$0 must be called with BASE_TARGET KERNEL_FLAVORS DRIVER_BRANCHES DIST" >&2
3+
echo " Error:$0 must be called with KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL" >&2
44
exit 1
55
fi
66

7-
local BASE_TARGET="$1"
8-
local -a KERNEL_FLAVORS=("${!2}")
9-
local -a DRIVER_BRANCHES=("${!3}")
10-
local DIST="$4"
7+
local -a KERNEL_FLAVORS=("${!1}")
8+
local -a DRIVER_BRANCHES=("${!2}")
9+
local DIST="$3"
10+
local LTS_KERNEL="$4"
1111

1212
kernel_versions=()
1313
for kernel_flavor in "${KERNEL_FLAVORS[@]}"; do
1414
for DRIVER_BRANCH in "${DRIVER_BRANCHES[@]}"; do
15-
source ./tests/scripts/findkernelversion.sh "$BASE_TARGET" "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" >&2
15+
source ./tests/scripts/findkernelversion.sh "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" "$LTS_KERNEL" >&2
1616
if [[ "$should_continue" == true ]]; then
1717
break
1818
fi

tests/scripts/findkernelversion.sh

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/bash
22

33
if [[ $# -ne 4 ]]; then
4-
echo " BASE_TARGET KERNEL_FLAVOR DRIVER_BRANCH DIST are required"
4+
echo " KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL are required"
55
exit 1
66
fi
77

8-
export BASE_TARGET="${1}"
9-
export KERNEL_FLAVOR="${2}"
10-
export DRIVER_BRANCH="${3}"
11-
export DIST="${4}"
8+
export KERNEL_FLAVOR="${1}"
9+
export DRIVER_BRANCH="${2}"
10+
export DIST="${3}"
11+
export LTS_KERNEL="${4}"
1212

1313
export REGCTL_VERSION=v0.7.1
1414
mkdir -p bin
@@ -17,30 +17,20 @@ chmod a+x bin/regctl
1717
export PATH=$(pwd)/bin:${PATH}
1818

1919
# calculate kernel version of latest image
20-
regctl image get-file ghcr.io/nvidia/driver:base-${BASE_TARGET}-${KERNEL_FLAVOR}-${DRIVER_BRANCH} /var/kernel_version.txt ./kernel_version.txt 2>/dev/null || true
21-
if [[ -f ./kernel_version.txt && -s ./kernel_version.txt ]]; then
22-
# File exists and is not empty
23-
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
24-
rm -f kernel_version.txt
25-
else
26-
# Define variables for artifact pattern
27-
prefix="kernel-version-${DRIVER_BRANCH}-${LTS_KERNEL}"
28-
suffix="${kernel_flavor}-${DIST}"
29-
artifacts=$(gh api -X GET /repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts --jq '.artifacts[].name')
30-
# Use a loop or a pattern to find the matching artifact dynamically
31-
for artifact in $artifacts; do
32-
# TODO remove this check once nvidia avaialble
33-
# currently for ubuntu24.04 kernel_flavor = nvidia-lowlatency
34-
if [[ $artifact == $prefix*-$suffix ]]; then
35-
gh run download --name "$artifact" --dir ./
36-
tar -xf $artifact.tar
37-
rm -f $artifact.tar
38-
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
39-
rm -f kernel_version.txt
40-
break
41-
fi
42-
done
43-
fi
20+
prefix="kernel-version-${DRIVER_BRANCH}-${LTS_KERNEL}"
21+
suffix="${kernel_flavor}-${DIST}"
22+
artifacts=$(gh api -X GET /repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts --paginate --jq '.artifacts[].name')
23+
# find the matching artifact dynamically
24+
for artifact in $artifacts; do
25+
if [[ $artifact == $prefix*-$suffix ]]; then
26+
gh run download --name "$artifact" --dir ./
27+
tar -xf $artifact.tar
28+
rm -f $artifact.tar
29+
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
30+
rm -f kernel_version.txt
31+
break
32+
fi
33+
done
4434

4535
# calculate driver tag
4636
status=0

0 commit comments

Comments
 (0)