Skip to content

Commit d51143f

Browse files
committed
script/setup/install-runc: fix runc using incorrect version
runc v1.1.13 introduced an option to customize the version (as printed by the `--version` flag) through a `VERSION` Make variable / environment variable (see [1]). This variable collided with the `VERSION` environment variable used by containerd for the same purpose, which lead to `runc` binaries built using the version of containerd; runc --version runc version 1.7.20 commit: v1.1.13-0-g58aa9203 ... This patch unsets the `VERSION` variable to bring prevent it from being inherited and to bring back the previous behavior. Before this patch: docker build -t containerd-test -f contrib/Dockerfile.test . docker run -it --rm --env VERSION=1.7.20 containerd-test sh -c 'script/setup/install-runc && /usr/local/sbin/runc --version' # .... HEAD is now at 58aa9203 VERSION: release 1.1.13 go build -trimpath "-buildmode=pie" -tags "seccomp" -ldflags "-X main.gitCommit=v1.1.13-0-g58aa9203 -X main.version=1.7.20 " -o runc . install -D -m0755 runc /usr/local/sbin/runc /go/src/github.com/containerd/containerd runc version 1.7.20 commit: v1.1.13-0-g58aa9203 spec: 1.0.2-dev go: go1.22.5 libseccomp: 2.5.4 With this patch: docker build -t containerd-test -f contrib/Dockerfile.test . docker run -it --rm --env VERSION=1.7.20 containerd-test sh -c 'script/setup/install-runc && /usr/local/sbin/runc --version' # .... HEAD is now at 58aa9203 VERSION: release 1.1.13 go build -trimpath "-buildmode=pie" -tags "seccomp" -ldflags "-X main.gitCommit=v1.1.13-0-g58aa9203 -X main.version=v1.1.13 " -o runc . install -D -m0755 runc /usr/local/sbin/runc /go/src/github.com/containerd/containerd runc version v1.1.13 commit: v1.1.13-0-g58aa9203 spec: 1.0.2-dev go: go1.22.5 libseccomp: 2.5.4 [1]: opencontainers/runc@6f4d975 Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 349d2b5) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 68b3461 commit d51143f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script/setup/install-runc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function install_runc() {
3737
git clone "${RUNC_REPO}" "${TMPROOT}"/runc
3838
pushd "${TMPROOT}"/runc
3939
git checkout "${RUNC_VERSION}"
40-
make BUILDTAGS='seccomp' runc
40+
env -u VERSION make BUILDTAGS='seccomp' runc
4141
$SUDO make install
4242
popd
4343
rm -fR "${TMPROOT}"

0 commit comments

Comments
 (0)