From b0d6948d9423ff58b267bdbe119abea66beab2c4 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 29 Nov 2021 14:35:41 +0100 Subject: [PATCH] Add versions.mk file to define versions Signed-off-by: Evan Lezar --- Makefile | 9 +-------- build/container/Makefile | 13 ++++--------- scripts/get-component-versions.sh | 9 +++++---- versions.mk | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 versions.mk diff --git a/Makefile b/Makefile index 04aea7ee..5e517cdb 100644 --- a/Makefile +++ b/Makefile @@ -16,15 +16,8 @@ DOCKER ?= docker MKDIR ?= mkdir DIST_DIR ?= $(CURDIR)/dist -LIB_NAME := nvidia-container-toolkit -LIB_VERSION := 1.7.0 -LIB_TAG := rc.2 +include $(CURDIR)/versions.mk -# Specify the nvidia-docker2 and nvidia-container-runtime package versions -NVIDIA_DOCKER_VERSION := 2.8.0 -NVIDIA_CONTAINER_RUNTIME_VERSION := 3.6.0 - -GOLANG_VERSION := 1.16.3 MODULE := github.com/NVIDIA/nvidia-container-toolkit # By default run all native docker-based targets diff --git a/build/container/Makefile b/build/container/Makefile index e685b9a0..bb87d3c8 100644 --- a/build/container/Makefile +++ b/build/container/Makefile @@ -17,21 +17,16 @@ MKDIR ?= mkdir DIST_DIR ?= $(CURDIR)/dist ##### Global variables ##### +include $(CURDIR)/versions.mk -# TODO: These should be defined ONCE and currently duplicate the version in the -# toolkit makefile. -LIB_VERSION := 1.7.0 -LIB_TAG := rc.2 - -VERSION ?= $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG)) - -CUDA_VERSION ?= 11.4.2 -GOLANG_VERSION ?= 1.16.4 +GOLANG_VERSION := 1.16.4 ifeq ($(IMAGE_NAME),) REGISTRY ?= nvidia IMAGE_NAME := $(REGISTRY)/container-toolkit endif +VERSION ?= $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG)) + IMAGE_TAG ?= $(VERSION)-$(DIST) IMAGE = $(IMAGE_NAME):$(IMAGE_TAG) diff --git a/scripts/get-component-versions.sh b/scripts/get-component-versions.sh index b1ef6c52..b14e092e 100755 --- a/scripts/get-component-versions.sh +++ b/scripts/get-component-versions.sh @@ -37,18 +37,19 @@ NVIDIA_DOCKER_ROOT=${PROJECT_ROOT}/third_party/nvidia-docker libnvidia_container_version_tag=$(grep "#define NVC_VERSION" ${LIBNVIDIA_CONTAINER_ROOT}/src/nvc.h \ | sed -e 's/#define NVC_VERSION[[:space:]]"\(.*\)"/\1/') +versions_makefile=${NVIDIA_CONTAINER_TOOLKIT_ROOT}/versions.mk # 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=$(grep -m 1 "^LIB_VERSION := " ${versions_makefile} | sed -e 's/LIB_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') +nvidia_container_toolkit_tag=$(grep -m 1 "^LIB_TAG .= " ${versions_makefile} | sed -e 's/LIB_TAG .=[[:space:]]\(.*\)[[:space:]]*/\1/') 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 "^NVIDIA_CONTAINER_RUNTIME_VERSION := " ${NVIDIA_CONTAINER_TOOLKIT_ROOT}/Makefile | sed -e 's/NVIDIA_CONTAINER_RUNTIME_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') +nvidia_container_runtime_version=$(grep -m 1 "^NVIDIA_CONTAINER_RUNTIME_VERSION := " ${versions_makefile} | sed -e 's/NVIDIA_CONTAINER_RUNTIME_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') nvidia_container_runtime_tag=${nvidia_container_toolkit_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 "^NVIDIA_DOCKER_VERSION := " ${NVIDIA_CONTAINER_TOOLKIT_ROOT}/Makefile | sed -e 's/NVIDIA_DOCKER_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') +nvidia_docker_version=$(grep -m 1 "^NVIDIA_DOCKER_VERSION := " ${versions_makefile} | sed -e 's/NVIDIA_DOCKER_VERSION :=[[:space:]]\(.*\)[[:space:]]*/\1/') nvidia_docker_tag=${nvidia_container_toolkit_tag} nvidia_docker_version_tag="${nvidia_docker_version}${nvidia_docker_tag:+~${nvidia_docker_tag}}" diff --git a/versions.mk b/versions.mk new file mode 100644 index 00000000..44a78f30 --- /dev/null +++ b/versions.mk @@ -0,0 +1,24 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LIB_NAME := nvidia-container-toolkit +LIB_VERSION := 1.7.0 +LIB_TAG := rc.2 + +# Specify the nvidia-docker2 and nvidia-container-runtime package versions +NVIDIA_DOCKER_VERSION := 2.8.0 +NVIDIA_CONTAINER_RUNTIME_VERSION := 3.6.0 + +CUDA_VERSION := 11.4.2 +GOLANG_VERSION := 1.16.3