Skip to content

Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS#5171

Merged
lifubang merged 1 commit intoopencontainers:mainfrom
kolyshkin:runc-buildtags
Mar 19, 2026
Merged

Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS#5171
lifubang merged 1 commit intoopencontainers:mainfrom
kolyshkin:runc-buildtags

Conversation

@kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Mar 12, 2026

A bit of history. EXTRA_BUILDTAGS was introduced in commit dac4171, as a quick way to add some extra Go build tags to the runc build.

Later, commit 767bc00 changed Makefile to not get EXTRA_TAGS from the shell environment, as the name is quite generic and some unrelated environment variable with that name can affect runc build. While such change does make sense, it makes it more complicated to pass build tags in CI and otherwise (see e.g. commit 0e1fe36).

Moreover, runc build uses some Go build tags by default (via Makefile), and while it is easy to add more build tags (via EXTRA_BUILDTAGS), in order to remove some existing tags one has to redefine BUILDTAGS from scratch, which is not very convenient (again, see commit 0e1fe36 which gets the value of BUILDTAGS from the Makefile in order to remove a single tag).

To handle all of the above, let's do this:

  • implement RUNC_BUILDTAGS, fixing the issue of not-so-unique name;
  • allow to get RUNC_BUILDTAGS from shell environment;
  • implement a feature to remove a build tag from default set by prefixing it with "-" (as in RUNC_BUILDTAGS="-seccomp");
  • document all this in README;
  • make CI use the new feature;
  • keep EXTRA_BUILDTAGS for backward compatibility, add a make warning
    and a TODO to remove it for runc 1.6.

Fixes: #5165.

@kolyshkin kolyshkin added this to the 1.5.0 milestone Mar 12, 2026
@kolyshkin kolyshkin requested review from cyphar, lifubang and rata and removed request for cyphar March 12, 2026 21:35
@kolyshkin kolyshkin marked this pull request as ready for review March 12, 2026 22:08
@kolyshkin kolyshkin requested a review from cyphar March 13, 2026 00:04
Copy link
Member

@rata rata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! I've been playing a little here, works like a charm! :)

@cyphar
Copy link
Member

cyphar commented Mar 13, 2026

I like this quite a lot, my only concern is that packagers probably rely on EXTRA_BUILDTAGS and so we should probably deprecate it for a release before removing it.

BUILDTAGS := seccomp urfave_cli_no_docs libpathrs
BUILDTAGS += $(EXTRA_BUILDTAGS)
# Tags prefixed with - in RUNC_BUILDTAGS are removed from BUILDTAGS; others are added.
BUILDTAGS_REMOVE := $(patsubst -%,%,$(filter -%,$(RUNC_BUILDTAGS)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for tab-completion (when passing things via command-line arguments) to work, you need to define this variable. RUNC_BUILDTAGS ?= is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Wonder what tab-completion are you using? I have bash-completion-2.16-2.fc43.noarch and it only completes make targets for me.

@kolyshkin
Copy link
Contributor Author

kolyshkin commented Mar 16, 2026

I like this quite a lot, my only concern is that packagers probably rely on EXTRA_BUILDTAGS and so we should probably deprecate it for a release before removing it.

I was thinking about adding a deprecation message -- the problem is no one will see it. Let's try it though; added :)

@kolyshkin kolyshkin added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Mar 16, 2026
@kolyshkin kolyshkin changed the title Makefile: add RUNC_BUILDTAGS, drop EXTRA_BUILDTAGS Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS Mar 16, 2026
@kolyshkin kolyshkin requested review from cyphar and thaJeztah March 16, 2026 18:18
@kolyshkin
Copy link
Contributor Author

@cyphar ptal

A bit of history. EXTRA_BUILDTAGS was introduced in commit dac4171,
as a quick way to add some extra Go build tags to the runc build.

Later, commit 767bc00 changed Makefile to not get EXTRA_TAGS from the
shell environment, as the name is quite generic and some unrelated
environment variable with that name can affect runc build. While such
change does make sense, it makes it more complicated to pass build tags
in CI and otherwise (see e.g. commit 0e1fe36).

Moreover, runc build uses some Go build tags by default (via Makefile),
and while it is easy to add more build tags (via EXTRA_BUILDTAGS), in
order to remove some existing tags one has to redefine BUILDTAGS from
scratch, which is not very convenient (again, see commit 0e1fe36 which
gets the current value of BUILDTAGS from the Makefile in order to remove
a single tag).

To handle all of the above, let's do this:
 - implement RUNC_BUILDTAGS, fixing the issue of not-so-unique name;
 - allow to get RUNC_BUILDTAGS from shell environment;
 - implement a feature to remove a build tag from default set by
   prefixing it with "-" (as in RUNC_BUILDTAGS="-seccomp");
 - document all this in README;
 - make CI use the new feature;
 - keep EXTRA_BUILDTAGS for backward compatibility, add a make warning
   and a TODO to remove it for runc 1.6.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@lifubang
Copy link
Member

@cyphar ptal

Looks like we’ve addressed all of Cyphar’s suggestions -- ready to merge!

@lifubang lifubang merged commit 837e98c into opencontainers:main Mar 19, 2026
63 checks passed
@cyphar
Copy link
Member

cyphar commented Mar 19, 2026

Yeah (post-merge) LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.5-todo A PR in main branch which needs to be backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

makefile: make buildtag configuration esier

4 participants