Skip to content

Commit 5d3792e

Browse files
committed
build-sys: Various cleanups, doc clarification
First change `.dockerignore` to be an allowlist. This avoids spurious rebuilds when touching e.g. `tmt/`, and also crucially we don't leak `.git/` into the sources which can easily change as one makes commits/branches. This also requires touching the `hack/` directory which is now fully self contained. While we're here, make clear the roles of Justfile vs Makefile. Remove the `make test`. Signed-off-by: Colin Walters <[email protected]>
1 parent 88364c0 commit 5d3792e

File tree

4 files changed

+54
-22
lines changed

4 files changed

+54
-22
lines changed

.dockerignore

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
# The big one - this can get HUGE and we don't want
2-
# to copy it around.
3-
target
4-
# This one can have large .qcow2 files written by coreos-assembler
5-
.cosa
6-
# TMT interprets these, not the container build
7-
plans/
8-
# These only affect flow outside of the container
9-
Dockerfile
10-
Justfile
11-
hack/Containerfile
1+
# Exclude everything by default, then include just what we need
2+
# Especially note this means that .git is not included, and not tests/
3+
# to avoid spurious rebuilds.
4+
*
5+
6+
# This one signals we're in a bootc toplevel
7+
!ADOPTERS.md
8+
# Toplevel build bits
9+
!Makefile
10+
!Cargo.*
11+
# We do build manpages from markdown
12+
!docs/
13+
# We use the spec file
14+
!contrib/
15+
# The systemd units and baseimage bits end up in installs
16+
!systemd/
17+
!baseimage/
18+
# And finally of course all the Rust sources
19+
!crates/

Justfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
# Build the container image from current sources
1+
# The default entrypoint to working on this project.
2+
# Commands here typically wrap e.g. `podman build` or
3+
# other tools which might launch e.g. VMs.
4+
#
5+
# See also `Makefile`.
6+
7+
# Build the container image from current sources.
8+
# Note commonly you might want to override the base image via e.g.
9+
# `just build --build-arg=base=quay.io/fedora/fedora-bootc:42`
210
build *ARGS:
311
podman build --jobs=4 -t localhost/bootc {{ARGS}} .
412

513
# This container image has additional testing content and utilities
614
build-integration-test-image *ARGS:
7-
podman build --jobs=4 -t localhost/bootc-integration -f hack/Containerfile {{ARGS}} .
15+
cd hack && podman build --jobs=4 -t localhost/bootc-integration -f Containerfile {{ARGS}} .
816
# Keep these in sync with what's used in hack/lbi
917
podman pull -q --retry 5 --retry-delay 5s quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.access.redhat.com/ubi9/podman:latest
1018

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Understanding Makefile vs Justfile:
2+
#
3+
# This file MUST NOT:
4+
# - Spawn podman or virtualization tools
5+
# - Invoke `sudo`
6+
#
7+
# Stated positively, the code invoked from here is only expected to
8+
# operate as part of "a build" that results in a bootc binary
9+
# plus data files. The two key operations are `make`
10+
# and `make install`.
11+
# We expect code run from here is inside a container with low
12+
# privileges - running as a nonzero UID even.
13+
114
prefix ?= /usr
215

316
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct)
@@ -79,9 +92,6 @@ bin-archive: all
7992
test-bin-archive: all
8093
$(MAKE) install-all DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
8194

82-
test:
83-
tests/build.sh && tests/test.sh
84-
8595
# This gates CI by default. Note that for clippy, we gate on
8696
# only the clippy correctness and suspicious lints, plus a select
8797
# set of default rustc warnings.

hack/Containerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,34 @@
55

66
FROM scratch as context
77
# We only need this stuff in the initial context
8-
COPY hack /hack
9-
COPY contrib /contrib
8+
COPY . /
109

11-
FROM localhost/bootc
10+
# An intermediate layer which caches the extended RPMS
11+
FROM localhost/bootc as extended
1212
# We support e.g. adding cloud-init
1313
ARG variant=
1414
# And this layer has additional stuff for testing, such as nushell etc.
1515
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
1616
set -xeuo pipefail
17-
cd /run/context/hack
17+
cd /run/context/
1818
./provision-derived.sh "$variant"
19+
EORUN
1920

21+
# And the configs
22+
FROM extended
23+
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
24+
set -xeuo pipefail
25+
cd /run/context
2026
# For test-22-logically-bound-install
2127
cp -a lbi/usr/. /usr
2228
for x in curl.container curl-base.image podman.image; do
2329
ln -s /usr/share/containers/systemd/$x /usr/lib/bootc/bound-images.d/$x
2430
done
2531

2632
# Add some testing kargs into our dev builds
27-
install -D -t /usr/lib/bootc/kargs.d /run/context/hack/test-kargs/*
33+
install -D -t /usr/lib/bootc/kargs.d test-kargs/*
2834
# Also copy in some default install configs we use for testing
29-
install -D -t /usr/lib/bootc/install/ /run/context/hack/install-test-configs/*
35+
install -D -t /usr/lib/bootc/install/ install-test-configs/*
3036
# Finally, test our own linting
3137
bootc container lint --fatal-warnings
3238
EORUN

0 commit comments

Comments
 (0)