Fix packaged runc reporting incorrect version#10556
Merged
mxpv merged 1 commit intocontainerd:mainfrom Aug 6, 2024
Merged
Conversation
fuweid
approved these changes
Aug 6, 2024
dmcgowan
approved these changes
Aug 6, 2024
cpuguy83
approved these changes
Aug 6, 2024
Member
cpuguy83
left a comment
There was a problem hiding this comment.
LGTM
This is cause by this change in runc: opencontainers/runc#4270
cpuguy83
requested changes
Aug 6, 2024
Member
cpuguy83
left a comment
There was a problem hiding this comment.
Actually, is that the right var to set? Maybe unset VERSION?
akhilerm
reviewed
Aug 6, 2024
script/setup/install-runc
Outdated
| pushd "${TMPROOT}"/runc | ||
| git checkout "${RUNC_VERSION}" | ||
| make BUILDTAGS='seccomp' runc | ||
| make BUILDTAGS='seccomp' VERSION="${RUNC_VERSION}" runc |
Member
There was a problem hiding this comment.
I think unsetting the VERSION in the context of install-runc will be better, so that it falls back to the behaviour of getting version as specified in the build script of runc.
Member
Author
|
Ah, yes, I actually first went for unsetting, then thought; perhaps we want to keep Let me change and push |
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]>
265ea9e to
349d2b5
Compare
akhilerm
approved these changes
Aug 6, 2024
Member
Author
|
@cpuguy83 updated; PTAL 🤗 |
cpuguy83
approved these changes
Aug 6, 2024
This was referenced Aug 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
runc v1.1.13 introduced an option to customize the version (as printed by the
--versionflag) through aVERSIONMake variable / environment variable (see 1).This variable collided with the
VERSIONenvironment variable used by containerd for the same purpose, which lead toruncbinaries built using the version of containerd;This patch explicitly sets the
VERSIONvariable to the version of runc being built when building the binary.Before this patch:
With this patch: