Skip to content

Commit 8558b70

Browse files
committed
cmd-build-with-buildah: add --direct
Support running buildah directly rather than through supermin. This is useful for devs like me who have buildah actually just proxy out of their container and to the host buildah.
1 parent 6bef1a2 commit 8558b70

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/cmd-build-with-buildah

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ Usage: coreos-assembler build-with-buildah
1515
1616
The following options are supported:
1717
--versionary Use the versionary script from the source config to drive version.
18+
--direct Run buildah directly rather than within supermin.
1819
EOF
1920
}
2021

2122
VERSIONARY=
2223
VERSION=
24+
DIRECT=
2325
rc=0
24-
options=$(getopt --options h,v --longoptions help,versionary -- "$@") || rc=$?
26+
options=$(getopt --options h,v,d --longoptions help,versionary,direct -- "$@") || rc=$?
2527
[ $rc -eq 0 ] || {
2628
print_help
2729
exit 1
@@ -36,6 +38,9 @@ while true; do
3638
-v | --versionary)
3739
VERSIONARY=1
3840
;;
41+
-d | --direct)
42+
DIRECT=1
43+
;;
3944
--)
4045
shift
4146
break
@@ -80,8 +85,14 @@ build_with_buildah() {
8085
set -- "$@" --build-arg VERSION="${VERSION}"
8186
fi
8287

83-
/usr/lib/coreos-assembler/cmd-supermin-run --cache \
84-
env -C "${tempdir}/src" TMPDIR="$(realpath cache)" buildah "$@" .
88+
if [ -n "$DIRECT" ]; then
89+
# turn on layer caching in the direct case; it wouldn't hurt in the
90+
# supermin path, but it'd be a waste of space on the rootfs
91+
env -C "${tempdir}/src" buildah "$@" --layers=true .
92+
else
93+
/usr/lib/coreos-assembler/cmd-supermin-run --cache \
94+
env -C "${tempdir}/src" TMPDIR="$(realpath cache)" buildah "$@" .
95+
fi
8596

8697
/usr/lib/coreos-assembler/cmd-import "oci-archive:${tmp_oci_archive_path}"
8798

0 commit comments

Comments
 (0)