Skip to content

Commit a99033d

Browse files
committed
build: Add a --prepare-only flag
Part of #2685 I'm looking at replacing the guts of `cosa build ostree` with the new container-native `rpm-ostree compose image`. In order for that to work, we need two things: - The committed overlays from `overlays/` - xref coreos/rpm-ostree#4005 - The rendered `image.json` which is also an overlay now Basically in combination with the above PR, this works now when invoked manually: ``` $ cosa build --prepare-only $ sudo rpm-ostree compose image --cachedir=cache/buildimage --layer-repo tmp/repo src/config/manifest.yaml oci:tmp/fcos.oci ```
1 parent 484c148 commit a99033d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/cmd-build

+12-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Usage: coreos-assembler build --help
2929
--skip-prune Skip prunning previous builds
3030
-F | --fetch Also perform a fetch
3131
--strict Only allow installing locked packages when using lockfiles
32+
--prepare-only Do not actually build, only set things up so that `rpm-ostree compose image` works.
3233
--version VERSION Use the given version instead of generating one based on current time
3334
3435
Additional environment variables supported:
@@ -45,12 +46,13 @@ FORCE=
4546
FORCE_IMAGE=
4647
FETCH=
4748
SKIP_PRUNE=0
49+
PREPARE_ONLY=0
4850
VERSION=
4951
PARENT=
5052
PARENT_BUILD=
5153
STRICT=
5254
rc=0
53-
options=$(getopt --options hfFt: --longoptions help,fetch,force,version:,parent:,parent-build:,delay-meta-merge,force-nocache,force-image,skip-prune,strict -- "$@") || rc=$?
55+
options=$(getopt --options hfFt: --longoptions help,fetch,force,version:,parent:,parent-build:,delay-meta-merge,force-nocache,force-image,skip-prune,prepare-only,strict -- "$@") || rc=$?
5456
[ $rc -eq 0 ] || {
5557
print_help
5658
exit 1
@@ -77,6 +79,9 @@ while true; do
7779
--skip-prune)
7880
SKIP_PRUNE=1
7981
;;
82+
--prepare-only)
83+
PREPARE_ONLY=1
84+
;;
8085
--strict)
8186
STRICT=1
8287
;;
@@ -278,6 +283,12 @@ extra_compose_args+=("$parent_arg")
278283
lockfile_out=${tmprepo}/tmp/manifest-lock.generated.${basearch}.json
279284
# shellcheck disable=SC2119
280285
prepare_compose_overlays
286+
287+
if test "${PREPARE_ONLY}" = 1; then
288+
echo "Option --prepare-only was specified; exiting"
289+
exit 0
290+
fi
291+
281292
# See https://github.com/coreos/coreos-assembler/pull/1379 - we want the local
282293
# dev case to explicitly fetch updates when they want them, plus CI pipelines
283294
# generally want to react to "changed or not" with a separate `fetch`.

0 commit comments

Comments
 (0)