From 988e067091f1692d17c717091b741711ae215aa8 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 4 Nov 2021 16:47:37 +0100 Subject: [PATCH] Forward nvidia-container-toolkit versions to dependants Signed-off-by: Evan Lezar --- scripts/build-all-components.sh | 18 ++++++++++++------ scripts/get-component-versions.sh | 13 +++++++------ scripts/release.sh | 4 ++++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/build-all-components.sh b/scripts/build-all-components.sh index 528c2f3d..a3de5fe4 100755 --- a/scripts/build-all-components.sh +++ b/scripts/build-all-components.sh @@ -55,13 +55,19 @@ make -C ${LIBNVIDIA_CONTAINER_ROOT} -f mk/docker.mk ${TARGET} # Build nvidia-container-toolkit make -C ${NVIDIA_CONTAINER_TOOLKIT_ROOT} ${TARGET} -# We set the TOOLKIT_VERSION for the nvidia-container-runtime and nvidia-docker targets -# TODO: This is not yet enabled in the makefiles below -: ${PREVIOUS_TOOLKIT_VERSION:=1.5.1} -echo "Using TOOLKIT_VERSION=${PREVIOUS_TOOLKIT_VERSION} as previous nvidia-container-toolkit version" +if [[ -z ${NVIDIA_CONTAINER_TOOLKIT_VERSION} ]]; then +eval $(${SCRIPTS_DIR}/get-component-versions.sh) +fi +# We set the TOOLKIT_VERSION for the nvidia-container-runtime and nvidia-docker targets # Build nvidia-container-runtime -make -C ${NVIDIA_CONTAINER_RUNTIME_ROOT} TOOLKIT_VERSION=${PREVIOUS_TOOLKIT_VERSION} ${TARGET} +make -C ${NVIDIA_CONTAINER_RUNTIME_ROOT} \ + TOOLKIT_VERSION="${NVIDIA_CONTAINER_TOOLKIT_VERSION}" \ + TOOLKIT_TAG="${NVIDIA_CONTAINER_TOOLKIT_TAG}" \ + ${TARGET} # Build nvidia-docker2 -make -C ${NVIDIA_DOCKER_ROOT} TOOLKIT_VERSION=${PREVIOUS_TOOLKIT_VERSION} ${TARGET} +make -C ${NVIDIA_DOCKER_ROOT} \ + TOOLKIT_VERSION="${NVIDIA_CONTAINER_TOOLKIT_VERSION}" \ + TOOLKIT_TAG="${NVIDIA_CONTAINER_TOOLKIT_TAG}" \ + ${TARGET} diff --git a/scripts/get-component-versions.sh b/scripts/get-component-versions.sh index 2c51a700..758078be 100755 --- a/scripts/get-component-versions.sh +++ b/scripts/get-component-versions.sh @@ -34,28 +34,29 @@ PROJECT_ROOT="$( cd ${SCRIPTS_DIR}/.. && pwd )" : ${NVIDIA_DOCKER_ROOT:=${PROJECT_ROOT}/third_party/nvidia-docker} # Get version for libnvidia-container -libnvidia_container_version=$(grep "#define NVC_VERSION" ${LIBNVIDIA_CONTAINER_ROOT}/src/nvc.h \ +libnvidia_container_version_tag=$(grep "#define NVC_VERSION" ${LIBNVIDIA_CONTAINER_ROOT}/src/nvc.h \ | sed -e 's/#define NVC_VERSION[[:space:]]"\(.*\)"/\1/') # Get version for nvidia-container-toolit nvidia_container_toolkit_version=$(grep -m 1 "^LIB_VERSION := " ${NVIDIA_CONTAINER_TOOLKIT_ROOT}/Makefile | sed -e 's/LIB_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') nvidia_container_toolkit_tag=$(grep -m 1 "^LIB_TAG .= " ${NVIDIA_CONTAINER_TOOLKIT_ROOT}/Makefile | sed -e 's/LIB_TAG .=[[:space:]]\(.*\)[[:space:]]*/\1/') -nvidia_container_toolkit_version="${nvidia_container_toolkit_version}${nvidia_container_toolkit_tag:+~${nvidia_container_toolkit_tag}}" +nvidia_container_toolkit_version_tag="${nvidia_container_toolkit_version}${nvidia_container_toolkit_tag:+~${nvidia_container_toolkit_tag}}" # Get version for nvidia-container-runtime nvidia_container_runtime_version=$(grep -m 1 "^LIB_VERSION := " ${NVIDIA_CONTAINER_RUNTIME_ROOT}/Makefile | sed -e 's/LIB_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') nvidia_container_runtime_tag=$(grep -m 1 "^LIB_TAG .= " ${NVIDIA_CONTAINER_RUNTIME_ROOT}/Makefile | sed -e 's/LIB_TAG .=[[:space:]]\(.*\)[[:space:]]*/\1/') -nvidia_container_runtime_version="${nvidia_container_runtime_version}${nvidia_container_runtime_tag:+~${nvidia_container_runtime_tag}}" +nvidia_container_runtime_version_tag="${nvidia_container_runtime_version}${nvidia_container_runtime_tag:+~${nvidia_container_runtime_tag}}" # Get version for nvidia-docker nvidia_docker_version=$(grep -m 1 "^LIB_VERSION := " ${NVIDIA_DOCKER_ROOT}/Makefile | sed -e 's/LIB_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') nvidia_docker_tag=$(grep -m 1 "^LIB_TAG .= " ${NVIDIA_DOCKER_ROOT}/Makefile | sed -e 's/LIB_TAG .=[[:space:]]\(.*\)[[:space:]]*/\1/') -nvidia_docker_version="${nvidia_docker_version}${nvidia_docker_tag:+~${nvidia_docker_tag}}" +nvidia_docker_version_tag="${nvidia_docker_version}${nvidia_docker_tag:+~${nvidia_docker_tag}}" -echo "LIBNVIDIA_CONTAINER_VERSION=${libnvidia_container_version}" +echo "LIBNVIDIA_CONTAINER_VERSION=${libnvidia_container_version_tag}" echo "NVIDIA_CONTAINER_TOOLKIT_VERSION=${nvidia_container_toolkit_version}" -if [[ "${libnvidia_container_version}" != "${nvidia_container_toolkit_version}" ]]; then +echo "NVIDIA_CONTAINER_TOOLKIT_TAG=${nvidia_container_toolkit_tag}" +if [[ "${libnvidia_container_version_tag}" != "${nvidia_container_toolkit_version_tag}" ]]; then >&2 echo "WARNING: The libnvidia-container and nvidia-container-toolkit versions do not match" fi echo "NVIDIA_CONTAINER_RUNTIME_VERSION=${nvidia_container_runtime_version}" diff --git a/scripts/release.sh b/scripts/release.sh index 7b54eea1..e436d899 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -52,6 +52,10 @@ else targets=${all[@]} fi +eval $(${SCRIPTS_DIR}/get-component-versions.sh) +export NVIDIA_CONTAINER_TOOLKIT_VERSION +export NVIDIA_CONTAINER_TOOLKIT_TAG + for target in ${targets[@]}; do ${SCRIPTS_DIR}/build-all-components.sh ${target} done