Skip to content

Commit 8457014

Browse files
author
Evan Lezar
committed
Merge branch 'build-from-repo' into 'master'
Add logic to build all package from nvidia-container-toolkit repo See merge request nvidia/container-toolkit/container-toolkit!49
2 parents 3fef6bb + 1ad98df commit 8457014

25 files changed

+639
-14
lines changed

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "third_party/libnvidia-container"]
2+
path = third_party/libnvidia-container
3+
url = https://gitlab.com/nvidia/container-toolkit/libnvidia-container.git
4+
[submodule "third_party/nvidia-container-runtime"]
5+
path = third_party/nvidia-container-runtime
6+
url = https://gitlab.com/nvidia/container-toolkit/container-runtime.git
7+
[submodule "third_party/nvidia-docker"]
8+
path = third_party/nvidia-docker
9+
url = https://gitlab.com/nvidia/container-toolkit/nvidia-docker.git

DEVELOPMENT.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# NVIDIA Container Toolkit Release Tooling
2+
3+
This repository allows for the components of the NVIDIA container stack to be
4+
built and released as the NVIDIA Container Toolkit from a single repository. The components:
5+
* `libnvidia-container`
6+
* `nvidia-container-runtime`
7+
* `nvidia-docker`
8+
are included as submodules in the `third_party` folder.
9+
10+
The `nvidia-container-toolkit` resides in this repo directly.
11+
12+
## Building
13+
14+
In oder to build the packages, the following command is executed
15+
```sh
16+
./scripts/build-all-components.sh TARGET
17+
```
18+
where `TARGET` is a make target that is valid for each of the sub-components.
19+
20+
These include:
21+
* `ubuntu18.04-amd64`
22+
* `docker-all`
23+
with the later generating for all supported distribution and platform combinations.
24+
25+
The packages are generated in the `dist` folder.
26+
27+
## Testing local changes
28+
29+
In oder to use the same build logic to be used to generate packages with local changes,
30+
the location of the individual components can be overridded using the: `LIBNVIDIA_CONTAINER_ROOT`,
31+
`NVIDIA_CONTAINER_TOOLKIT_ROOT`, `NVIDIA_CONTAINER_RUNTIME_ROOT`, and `NVIDIA_DOCKER_ROOT`
32+
environment variables.
33+
34+
## Testing packages locally
35+
36+
### Ubuntu
37+
38+
Launch a docker container:
39+
40+
```
41+
docker run --rm -it \
42+
-v $(pwd):/work \
43+
-v $(pwd)/dist/ubuntu18.04/amd64:/local-repository \
44+
-w /work \
45+
ubuntu:18.04
46+
```
47+
48+
49+
```
50+
apt-get update && apt-get install -y apt-utils
51+
```
52+
53+
```
54+
echo "deb [trusted=yes] file:/local-repository/ ./" > /etc/apt/sources.list.d/local.list
55+
```
56+
57+
```
58+
cd /local-repository && apt-ftparchive packages . > Packages
59+
```
60+
61+
```
62+
apt-get update
63+
```
64+
65+
66+
67+
### Centos
68+
69+
```
70+
docker run --rm -it \
71+
-v $(pwd):/work \
72+
-v $(pwd)/dist/centos8/x86_64:/local-repository \
73+
-w /work \
74+
centos:8
75+
```
76+
77+
```
78+
yum install -y createrepo
79+
```
80+
81+
```
82+
createrepo /local-repository
83+
```
84+
85+
```
86+
cat >/etc/yum.repos.d/local.repo <<EOL
87+
[local]
88+
name=NVIDIA Container Toolkit Local Packages
89+
baseurl=file:///local-repository
90+
enabled=1
91+
gpgcheck=0
92+
protect=1
93+
EOL
94+
```

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ MKDIR ?= mkdir
1717
DIST_DIR ?= $(CURDIR)/dist
1818

1919
LIB_NAME := nvidia-container-toolkit
20-
LIB_VERSION := 1.5.2
20+
LIB_VERSION := 1.6.0
2121
LIB_TAG ?= rc.1
2222

2323
GOLANG_VERSION := 1.16.3
@@ -43,7 +43,7 @@ CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
4343
$(info CMD_TARGETS=$(CMD_TARGETS))
4444

4545
CHECK_TARGETS := assert-fmt vet lint ineffassign misspell
46-
MAKE_TARGETS := binaries build all check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS)
46+
MAKE_TARGETS := binaries build check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS)
4747

4848
TARGETS := $(MAKE_TARGETS) $(EXAMPLE_TARGETS) $(CMD_TARGETS)
4949

docker/Dockerfile.amazonlinux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ CMD arch=$(uname -m) && \
5959
rpmbuild --clean --target=$arch -bb \
6060
-D "_topdir $PWD" \
6161
-D "version $VERSION" \
62+
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \
6263
-D "release $RELEASE" \
6364
SPECS/nvidia-container-toolkit.spec && \
6465
mv RPMS/$arch/*.rpm /dist

docker/Dockerfile.centos

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ CMD arch=$(uname -m) && \
5757
rpmbuild --clean --target=$arch -bb \
5858
-D "_topdir $PWD" \
5959
-D "version $VERSION" \
60+
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \
6061
-D "release $RELEASE" \
6162
SPECS/nvidia-container-toolkit.spec && \
6263
mv RPMS/$arch/*.rpm /dist

docker/Dockerfile.debian

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \
6464
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
6565

6666
CMD export DISTRIB="$(lsb_release -cs)" && \
67-
debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
67+
debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_VERSION="${REVISION}" \
68+
--dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
6869
mv /tmp/nvidia-container-toolkit_*.deb /dist

docker/Dockerfile.opensuse-leap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ CMD arch=$(uname -m) && \
5656
rpmbuild --clean --target=$arch -bb \
5757
-D "_topdir $PWD" \
5858
-D "version $VERSION" \
59+
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \
5960
-D "release $RELEASE" \
6061
SPECS/nvidia-container-toolkit.spec && \
6162
mv RPMS/$arch/*.rpm /dist

docker/Dockerfile.ubuntu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \
5757
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
5858

5959
CMD export DISTRIB="$(lsb_release -cs)" && \
60-
debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
60+
debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_VERSION="${REVISION}" \
61+
--dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
6162
mv /tmp/*.deb /dist

docker/docker.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ docker-all: $(AMD64_TARGETS) $(X86_64_TARGETS) \
9797

9898
# private centos target
9999
--centos%: OS := centos
100-
--centos%: PKG_REV := $(if $(LIB_TAG),0.1.$(LIB_TAG),2)
100+
--centos%: PKG_REV := $(if $(LIB_TAG),0.1.$(LIB_TAG),1)
101101

102102
# private amazonlinux target
103103
--amazonlinux%: OS := amazonlinux
104-
--amazonlinux%: PKG_REV = $(if $(LIB_TAG),0.1.$(LIB_TAG).amzn$(VERSION),2.amzn$(VERSION))
104+
--amazonlinux%: PKG_REV := $(if $(LIB_TAG),0.1.$(LIB_TAG),1)
105105

106106
# private opensuse-leap target
107107
--opensuse-leap%: OS = opensuse-leap
@@ -110,7 +110,7 @@ docker-all: $(AMD64_TARGETS) $(X86_64_TARGETS) \
110110

111111
# private rhel target (actually built on centos)
112112
--rhel%: OS := centos
113-
--rhel%: PKG_REV := $(if $(LIB_TAG),0.1.$(LIB_TAG),2)
113+
--rhel%: PKG_REV := $(if $(LIB_TAG),0.1.$(LIB_TAG),1)
114114
--rhel%: VERSION = $(patsubst rhel%-$(ARCH),%,$(TARGET_PLATFORM))
115115
--rhel%: ARTIFACTS_DIR = $(DIST_DIR)/rhel$(VERSION)/$(ARCH)
116116

packaging/debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
nvidia-container-toolkit (1.5.2~rc.1-1) experimental; urgency=medium
1+
nvidia-container-toolkit (1.6.0~rc.1-1) experimental; urgency=medium
22

33
* Include nvidia-container-runtime into nvidia-container-toolkit package
44

0 commit comments

Comments
 (0)