mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS
A bit of history. EXTRA_BUILDTAGS was introduced in commitdac417174, as a quick way to add some extra Go build tags to the runc build. Later, commit767bc008changed 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. commit0e1fe368a). 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 commit0e1fe368awhich 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>
This commit is contained in:
@@ -84,12 +84,10 @@ jobs:
|
||||
run: |
|
||||
sudo -E PATH="$PATH" ./script/build-libpathrs.sh "$LIBPATHRS_VERSION" /usr
|
||||
|
||||
- name: configure custom BUILDTAGS
|
||||
- name: remove libpathrs build tag
|
||||
if: ${{ matrix.libpathrs == '' }}
|
||||
run: |-
|
||||
# Strip out libpathrs from the default buildtags.
|
||||
CUSTOM_BUILDTAGS="$(make -pn | sed -En '/^BUILDTAGS :?=/ { s/.*=// ; s/\blibpathrs\b//p }')"
|
||||
echo "CUSTOM_BUILDTAGS=$CUSTOM_BUILDTAGS" >>"$GITHUB_ENV"
|
||||
run: |
|
||||
echo RUNC_BUILDTAGS=-libpathrs >>"$GITHUB_ENV"
|
||||
|
||||
- name: install CRIU
|
||||
if: ${{ matrix.criu == '' }}
|
||||
@@ -121,11 +119,7 @@ jobs:
|
||||
check-latest: true
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
sudo -E PATH="$PATH" make \
|
||||
${CUSTOM_BUILDTAGS:+BUILDTAGS="$CUSTOM_BUILDTAGS"} \
|
||||
EXTRA_FLAGS="${{ matrix.race }}" \
|
||||
all
|
||||
run: sudo -E PATH="$PATH" make EXTRA_FLAGS="${{ matrix.race }}" all
|
||||
|
||||
- name: Setup Bats and bats libs
|
||||
uses: bats-core/bats-action@4.0.0
|
||||
@@ -144,7 +138,7 @@ jobs:
|
||||
|
||||
- name: unit test
|
||||
if: matrix.rootless != 'rootless'
|
||||
run: sudo -E PATH="$PATH" -- make ${CUSTOM_BUILDTAGS:+BUILDTAGS="$CUSTOM_BUILDTAGS"} TESTFLAGS="${{ matrix.race }}" localunittest
|
||||
run: sudo -E PATH="$PATH" -- make TESTFLAGS="${{ matrix.race }}" localunittest
|
||||
|
||||
- name: add rootless user
|
||||
if: matrix.rootless == 'rootless'
|
||||
@@ -154,7 +148,7 @@ jobs:
|
||||
|
||||
- name: integration test (fs driver)
|
||||
continue-on-error: ${{ matrix.criu != '' }} # Don't let criu-dev errors fail CI.
|
||||
run: sudo -E PATH="$PATH" script -e -c 'make ${CUSTOM_BUILDTAGS:+BUILDTAGS="$CUSTOM_BUILDTAGS"} local${{ matrix.rootless }}integration'
|
||||
run: sudo -E PATH="$PATH" script -e -c 'make local${{ matrix.rootless }}integration'
|
||||
|
||||
- name: integration test (systemd driver)
|
||||
continue-on-error: ${{ matrix.criu != '' }} # Don't let criu-dev errors fail CI.
|
||||
@@ -165,7 +159,7 @@ jobs:
|
||||
printf "[Service]\nDelegate=yes\n" | sudo tee /etc/systemd/system/user@.service.d/delegate.conf
|
||||
sudo systemctl daemon-reload
|
||||
# Run the tests.
|
||||
sudo -E PATH="$PATH" script -e -c 'make RUNC_USE_SYSTEMD=yes ${CUSTOM_BUILDTAGS:+BUILDTAGS="$CUSTOM_BUILDTAGS"} local${{ matrix.rootless }}integration'
|
||||
sudo -E PATH="$PATH" script -e -c 'make RUNC_USE_SYSTEMD=yes local${{ matrix.rootless }}integration'
|
||||
|
||||
# We need to continue support for 32-bit ARM.
|
||||
# However, we do not have 32-bit ARM CI, so we use i386 for testing 32bit stuff.
|
||||
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
- name: compile with no build tags
|
||||
run: make BUILDTAGS=""
|
||||
- name: compile with runc_nocriu build tag
|
||||
run: make EXTRA_BUILDTAGS="runc_nocriu"
|
||||
run: make RUNC_BUILDTAGS="runc_nocriu"
|
||||
|
||||
codespell:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
Reference in New Issue
Block a user