Build meta-packages before others

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-04-26 16:33:56 +02:00
parent 525aeb102f
commit 22c7178561
3 changed files with 49 additions and 6 deletions

View File

@ -102,8 +102,30 @@ unit-tests:
name: ${ARTIFACTS_NAME}
paths:
- ${ARTIFACTS_ROOT}
needs:
- job: package-meta-packages
artifacts: true
# Define the package build targets
package-meta-packages:
extends:
- .package-artifacts
stage: package-build
variables:
SKIP_LIBNVIDIA_CONTAINER: "yes"
SKIP_NVIDIA_CONTAINER_TOOLKIT: "yes"
parallel:
matrix:
- PACKAGING: [deb, rpm]
before_script:
- apk add --no-cache coreutils build-base sed git bash make
script:
- ./scripts/build-packages.sh ${PACKAGING}
artifacts:
name: ${ARTIFACTS_NAME}
paths:
- ${ARTIFACTS_ROOT}
package-amazonlinux2-aarch64:
extends:
- .package-build

View File

@ -51,18 +51,22 @@ echo "Building ${TARGET} for all packages to ${DIST_DIR}"
"${SCRIPTS_DIR}/get-component-versions.sh"
# Build libnvidia-container
make -C "${LIBNVIDIA_CONTAINER_ROOT}" -f mk/docker.mk "${TARGET}"
if [[ -z "${NVIDIA_CONTAINER_TOOLKIT_VERSION}" || -z "${LIBNVIDIA_CONTAINER_VERSION}" ]]; then
eval $(${SCRIPTS_DIR}/get-component-versions.sh)
fi
# Build libnvidia-container
if [[ -z ${SKIP_LIBNVIDIA_CONTAINER} ]]; then
make -C "${LIBNVIDIA_CONTAINER_ROOT}" -f mk/docker.mk "${TARGET}"
fi
if [[ -z ${SKIP_NVIDIA_CONTAINER_TOOLKIT} ]]; then
# Build nvidia-container-toolkit
make -C "${NVIDIA_CONTAINER_TOOLKIT_ROOT}" \
LIBNVIDIA_CONTAINER_VERSION="${LIBNVIDIA_CONTAINER_VERSION}" \
LIBNVIDIA_CONTAINER_TAG="${LIBNVIDIA_CONTAINER_TAG}" \
"${TARGET}"
fi
# If required we also build the nvidia-container-runtime and nvidia-docker packages.
# Since these are essentially meta packages intended to allow for users to
@ -71,6 +75,7 @@ make -C "${NVIDIA_CONTAINER_TOOLKIT_ROOT}" \
# version of 0.
if [[ -n ${FORCE_META_PACKAGES} || -z ${NVIDIA_CONTAINER_TOOLKIT_TAG} && "${NVIDIA_CONTAINER_TOOLKIT_VERSION%.0}" != "${NVIDIA_CONTAINER_TOOLKIT_VERSION}" ]]; then
package_format=$(package_type ${TARGET})
package_target=$(get_package_target ${TARGET})
# We set the TOOLKIT_VERSION, TOOLKIT_TAG for the nvidia-container-runtime and nvidia-docker targets
# The LIB_TAG is also overridden to match the TOOLKIT_TAG.
@ -89,7 +94,9 @@ if [[ -n ${FORCE_META_PACKAGES} || -z ${NVIDIA_CONTAINER_TOOLKIT_TAG} && "${NVID
TOOLKIT_TAG="${NVIDIA_CONTAINER_TOOLKIT_TAG}" \
${TARGET}
fi
cp ${package_pattern} ${DIST_DIR}/$(get_package_target ${TARGET})/
if [[ -n ${package_target} ]]; then
cp ${package_pattern} ${DIST_DIR}/${package_target}/
fi
# Build nvidia-docker2 if required
package_name="nvidia-docker2"
@ -105,7 +112,9 @@ if [[ -n ${FORCE_META_PACKAGES} || -z ${NVIDIA_CONTAINER_TOOLKIT_TAG} && "${NVID
TOOLKIT_TAG="${NVIDIA_CONTAINER_TOOLKIT_TAG}" \
${TARGET}
fi
cp ${package_pattern} ${DIST_DIR}/$(get_package_target ${TARGET})/
if [[ -n ${package_target} ]]; then
cp ${package_pattern} ${DIST_DIR}/${package_target}/
fi
else
echo "Skipping nvidia-container-runtime and nvidia-docker builds."

View File

@ -16,6 +16,10 @@ function package_type() {
;;
ubuntu*) pkg_type=deb
;;
deb) pkg_type=deb
;;
rpm) pkg_type=rpm
;;
*) exit 1
;;
esac
@ -39,5 +43,13 @@ function get_package_target() {
local target=$1
local dist=${target%-*}
local arch=${target##*-}
echo "${dist}/${arch}"
case ${target} in
deb) echo ""
;;
rpm) echo ""
;;
*) echo "${dist}/${arch}"
;;
esac
}