Skip to content

Commit

Permalink
ubuntu24.04 precompile image support
Browse files Browse the repository at this point in the history
Signed-off-by: shiva kumar <[email protected]>
  • Loading branch information
shivakunv committed Nov 26, 2024
1 parent aa64524 commit 0337fd3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 17 deletions.
62 changes: 45 additions & 17 deletions .github/workflows/precompiled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,28 @@ jobs:
dist_json=$(printf '%s\n' "${DIST[@]}" | jq -R . | jq -cs .)
echo "dist=$dist_json" >> $GITHUB_OUTPUT
# BASE_TARGET setup
declare -A MAP_BASE_TARGET
MAP_BASE_TARGET["ubuntu22.04"]="jammy"
MAP_BASE_TARGET["ubuntu24.04"]="noble"
BASE_TARGETS_JSON="{"
for key in "${!MAP_BASE_TARGET[@]}"; do
BASE_TARGETS_JSON+="\"$key\":\"${MAP_BASE_TARGET[$key]}\","
done
BASE_TARGETS_JSON="${BASE_TARGETS_JSON%,}}"
echo "BASE_TARGETS=$BASE_TARGETS_JSON" >> "$GITHUB_OUTPUT"
# LTS_KERNELS env setup
declare -A MAP_LTS_KERNELS
MAP_LTS_KERNELS["ubuntu22.04"]="5.15"
MAP_LTS_KERNELS["ubuntu24.04"]="6.8"
LTS_KERNELS_JSON="{"
for key in "${!MAP_LTS_KERNELS[@]}"; do
LTS_KERNEL_JSON+="\"$key\":\"${MAP_LTS_KERNELS[$key]}\","
done
LTS_KERNELS_JSON="${LTS_KERNELS_JSON%,}}"
echo "LTS_KERNELS=$LTS_KERNELS_JSON" >> "$GITHUB_OUTPUT"
precompiled-build-image:
needs: set-driver-version-matrix
runs-on: linux-amd64-cpu4
Expand Down Expand Up @@ -87,13 +109,13 @@ jobs:
echo "PUSH_ON_BUILD=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
echo "BUILD_MULTI_ARCH_IMAGES=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
if [ "$DIST" == "ubuntu22.04" ]; then
echo "BASE_TARGET=jammy" >> $GITHUB_OUTPUT
echo "LTS_KERNEL=5.15" >> $GITHUB_OUTPUT
elif [ "$DIST" == "ubuntu24.04" ]; then
echo "BASE_TARGET=noble" >> $GITHUB_OUTPUT
echo "LTS_KERNEL=6.8" >> $GITHUB_OUTPUT
fi
BASE_TARGETS_JSON='${{ needs.set-driver-version-matrix.outputs.BASE_TARGETS }}'
BASE_TARGET=$(echo "$BASE_TARGETS_JSON" | jq -r --arg dist "$DIST" '.[$dist]')
echo "BASE_TARGET=$BASE_TARGET" >> $GITHUB_ENV
LTS_KERNELS_JSON='${{ needs.set-driver-version-matrix.outputs.LTS_KERNELS }}'
LTS_KERNEL=$(echo "$LTS_KERNEL_JSON" | jq -r --arg dist "$DIST" '.[$dist]')
echo "LTS_KERNEL=$LTS_KERNEL" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -109,8 +131,8 @@ jobs:
env:
IMAGE_NAME: ghcr.io/nvidia/driver
VERSION: ${COMMIT_SHORT_SHA}
BASE_TARGET: ${{ steps.vars.outputs.BASE_TARGET }}
LTS_KERNEL: ${{ steps.vars.outputs.LTS_KERNEL }}
BASE_TARGET: ${{ env.BASE_TARGET }}
LTS_KERNEL: ${{ env.LTS_KERNEL }}
run: |
make DRIVER_BRANCH=${{ matrix.driver_branch }} KERNEL_FLAVOR=${{ matrix.flavor }} LTS_KERNEL=${LTS_KERNEL} build-base-${BASE_TARGET}
Expand Down Expand Up @@ -176,19 +198,25 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Calculate build vars
id: vars
env:
DIST: ${{ matrix.dist }}
run: |
BASE_TARGETS_JSON='${{ needs.set-driver-version-matrix.outputs.BASE_TARGETS }}'
BASE_TARGET=$(echo "$BASE_TARGETS_JSON" | jq -r --arg dist "$DIST" '.[$dist]')
echo "BASE_TARGET=$BASE_TARGET" >> $GITHUB_ENV
LTS_KERNELS_JSON='${{ needs.set-driver-version-matrix.outputs.LTS_KERNELS }}'
LTS_KERNEL=$(echo "$LTS_KERNEL_JSON" | jq -r --arg dist "$DIST" '.[$dist]')
echo "LTS_KERNEL=$LTS_KERNEL" >> $GITHUB_ENV
- name: Set kernel version
env:
DIST: ${{ matrix.dist }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_TARGET: ${{ env.BASE_TARGET }}
LTS_KERNEL: ${{ env.LTS_KERNEL }}
run: |
if [ "$DIST" == "ubuntu22.04" ]; then
export BASE_TARGET="jammy"
export LTS_KERNEL="5.15"
elif [ "$DIST" == "ubuntu24.04" ]; then
export BASE_TARGET="noble"
export LTS_KERNEL="6.8"
fi
kernel_flavors_json='${{ needs.set-driver-version-matrix.outputs.kernel_flavors }}'
KERNEL_FLAVORS=($(echo "$kernel_flavors_json" | jq -r '.[]'))
driver_branch_json='${{ needs.set-driver-version-matrix.outputs.driver_branch }}'
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ build-signed_ubuntu20.04%: DRIVER_TAG = $(DRIVER_BRANCH)

# ubuntu22.04 Precompiled Driver
build-signed_ubuntu22.04%: DIST = ubuntu22.04
build-signed_ubuntu22.04%: BASE_TARGET = jammy
build-signed_ubuntu22.04%: SUBDIR = ubuntu22.04/precompiled
build-signed_ubuntu22.04%: DRIVER_TAG = $(DRIVER_BRANCH)
build-signed_ubuntu22.04%: IMAGE_TAG = $(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
build-signed_ubuntu22.04%: DOCKER_BUILD_ARGS = --build-arg KERNEL_VERSION="$(KERNEL_VERSION)"

# ubuntu24.04 Precompiled Driver
build-signed_ubuntu24.04%: DIST = ubuntu24.04
build-signed_ubuntu24.04%: BASE_TARGET = noble
build-signed_ubuntu24.04%: SUBDIR = ubuntu24.04/precompiled
build-signed_ubuntu24.04%: DRIVER_TAG = $(DRIVER_BRANCH)
build-signed_ubuntu24.04%: IMAGE_TAG = $(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
Expand Down

0 comments on commit 0337fd3

Please sign in to comment.