From 18cdc3476f911b0905d46a6680130c5133b33354 Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Thu, 8 Aug 2024 12:10:16 +0200 Subject: [PATCH 1/2] Revert "allow overriding VERSION value in Makefile" This reverts commit 9d9273c926450a2f6f658768e3238b7082ec878d. This commit broke the build for several other projects (see comments here: https://github.com/opencontainers/runc/pull/4270, after the merge) and we don't really need this to be able to set the version without changing the file. With this commit reverted, we can still run: make VERSION="1.2.3" and it just works. It doesn't take it from an env variable, but that is what broke all the other projects (VERSION is just too generic as an env var, especially for a project like runc that is embedded in many others). Signed-off-by: Rodrigo Campos (cherry picked from commit f4cc3d83131363e3ecc609abbb2190f0403ce6c6) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c475b31f8d..e3af9bc13cc 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PROJECT := github.com/opencontainers/runc BUILDTAGS ?= seccomp COMMIT ?= $(shell git describe --dirty --long --always) -VERSION ?= $(shell cat ./VERSION) +VERSION := $(shell cat ./VERSION) LDFLAGS_COMMON := -X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) GOARCH := $(shell $(GO) env GOARCH) From 0514204d6fcca144d54b6db32a8112c135fca0b7 Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Wed, 14 Aug 2024 12:46:54 +0200 Subject: [PATCH 2/2] Makefile: Add EXTRA_VERSION Add this new make variable so users can specify build information without modifying the runc version nor the source code. Signed-off-by: Rodrigo Campos (cherry picked from commit cc2078ccddd1bf77fbc225ae5507eea6c125b956) --- Makefile | 3 ++- README.md | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e3af9bc13cc..452ee94ce58 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ PROJECT := github.com/opencontainers/runc BUILDTAGS ?= seccomp COMMIT ?= $(shell git describe --dirty --long --always) -VERSION := $(shell cat ./VERSION) +EXTRA_VERSION := +VERSION := $(shell cat ./VERSION)$(EXTRA_VERSION) LDFLAGS_COMMON := -X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) GOARCH := $(shell $(GO) env GOARCH) diff --git a/README.md b/README.md index 3b159978fa3..35c895fed33 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ sudo make install `runc` will be installed to `/usr/local/sbin/runc` on your system. +#### Version string customization + +You can see the runc version by running `runc --version`. You can append a custom string to the +version using the `EXTRA_VERSION` make variable when building, e.g.: + +```bash +make EXTRA_VERSION="+build-1" +``` + +Bear in mind to include some separator for readability. #### Build Tags