Skip to content

Commit

Permalink
donotmerge: IBX changes
Browse files Browse the repository at this point in the history
Some (trash, temporary) changes I had to perform on bootc to get IBX to work

- `./Containerfile` builds a bootable image from an existing normal IBX seed
- `./build_seed.sh` is just a helper script

To install on recipient

```
sudo podman run --privileged -v $PWD/authkeys:/authkeys --env RUST_LOG=trace -v /var/tmp:/var/tmp -v /var/lib/containers/storage:/var/lib/containers/storage --pid=host -it quay.io/otuchfel/bootc:seed bootc install to-existing-root --acknowledge-destructive --stateroot omeroot --root-ssh-authorized-keys /authkeys --bound-images pull
```

This PR only exists to start discussions around concrete issues, it's not meant to be merged.
  • Loading branch information
omertuc committed Dec 14, 2024
1 parent fa94050 commit 715d97a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ target
# These directories don't contribute to our container build
docs/
plans/
Containerfile
build_seed.sh
25 changes: 25 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM quay.io/centos/centos:stream9 as build
COPY hack/build.sh /build.sh
RUN /build.sh && rm -v /build.sh
COPY . /build
WORKDIR /build
RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
# We aren't using the full recommendations there, just the simple bits.
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar /out
RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content

FROM quay.io/otuchfel/ostbackup:serv1 as seed

# ____________________________________________________________________________

FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5b1124faf4b73753b4679085604dd8cb810c4a7a2e659978f5c80183bb165f94

LABEL com.openshift.lifecycle-agent.seed_format_version=3

RUN mkdir -p /usr/lib/bootc/install

COPY --from=seed --exclude=ostree.tgz / /var/tmp/seed

COPY --from=build /out/bootc.tar /tmp
RUN tar -C / -xvf /tmp/bootc.tar && rm -vrf /tmp/*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ install-all: install install-ostree-hooks
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests

bin-archive: all
$(MAKE) install DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
$(MAKE) install DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) -C tmp-install -cf target/bootc.tar . && rm tmp-install -rf

test-bin-archive: all
$(MAKE) install-all DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
$(MAKE) install-all DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) -C tmp-install -cf target/bootc.tar . && rm tmp-install -rf

test-tmt:
cargo xtask test-tmt
Expand Down
9 changes: 9 additions & 0 deletions build_seed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

SCRIPT_DIR=$(dirname $0)

cd $SCRIPT_DIR

podman build -t bootcseed -f Containerfile .
podman tag bootcseed:latest quay.io/otuchfel/bootc:seed
podman push quay.io/otuchfel/bootc:seed
6 changes: 3 additions & 3 deletions hack/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /build
RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
# We aren't using the full recommendations there, just the simple bits.
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar /out

FROM $base
# We support e.g. adding cloud-init
Expand All @@ -26,8 +26,8 @@ COPY hack/install-test-configs/* /usr/lib/bootc/install/
# And some test kargs
COPY hack/test-kargs /usr/lib/bootc/kargs.d/
# Inject our built code
COPY --from=build /out/bootc.tar.zst /tmp
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
COPY --from=build /out/bootc.tar /tmp
RUN tar -C / -xvf /tmp/bootc.tar && rm -vrf /tmp/*
# Also copy over arbitrary bits from the target root
COPY --from=build /build/target/dev-rootfs/ /
# Test our own linting
Expand Down
4 changes: 2 additions & 2 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,8 @@ fn ensure_var() -> Result<()> {
/// will traverse the link.
#[context("Linking tmp mounts to host")]
pub(crate) fn setup_tmp_mounts() -> Result<()> {
let st = rustix::fs::statfs("/tmp")?;
if st.f_type == libc::TMPFS_MAGIC {
let slash_tmp_statfs = rustix::fs::statfs("/tmp")?;
if slash_tmp_statfs.f_type == libc::TMPFS_MAGIC {
tracing::trace!("Already have tmpfs /tmp")
} else {
// Note we explicitly also don't want a "nosuid" tmp, because that
Expand Down

0 comments on commit 715d97a

Please sign in to comment.