Skip to content

Commit eca45b9

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 388f8d3 commit eca45b9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/cmd-build

Lines changed: 12 additions & 1 deletion
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
--tag TAG Set the given tag in the build metadata
3334
--version VERSION Use the given version instead of generating one based on current time
3435
@@ -46,13 +47,14 @@ FORCE=
4647
FORCE_IMAGE=
4748
FETCH=
4849
SKIP_PRUNE=0
50+
PREPARE_ONLY=0
4951
VERSION=
5052
PARENT=
5153
PARENT_BUILD=
5254
TAG=
5355
STRICT=
5456
rc=0
55-
options=$(getopt --options hfFt: --longoptions tag:,help,fetch,force,version:,parent:,parent-build:,delay-meta-merge,force-nocache,force-image,skip-prune,strict -- "$@") || rc=$?
57+
options=$(getopt --options hfFt: --longoptions tag:,help,fetch,force,version:,parent:,parent-build:,delay-meta-merge,force-nocache,force-image,skip-prune,prepare-only,strict -- "$@") || rc=$?
5658
[ $rc -eq 0 ] || {
5759
print_help
5860
exit 1
@@ -79,6 +81,9 @@ while true; do
7981
--skip-prune)
8082
SKIP_PRUNE=1
8183
;;
84+
--prepare-only)
85+
PREPARE_ONLY=1
86+
;;
8287
--strict)
8388
STRICT=1
8489
;;
@@ -284,6 +289,12 @@ extra_compose_args+=("$parent_arg")
284289
lockfile_out=${tmprepo}/tmp/manifest-lock.generated.${basearch}.json
285290
# shellcheck disable=SC2119
286291
prepare_compose_overlays
292+
293+
if test "${PREPARE_ONLY}" = 1; then
294+
echo "Option --prepare-only was specified; exiting"
295+
exit 0
296+
fi
297+
287298
# See https://github.com/coreos/coreos-assembler/pull/1379 - we want the local
288299
# dev case to explicitly fetch updates when they want them, plus CI pipelines
289300
# generally want to react to "changed or not" with a separate `fetch`.

0 commit comments

Comments
 (0)