Skip to content

Commit

Permalink
src/cmd-build: Add --ostree-only option
Browse files Browse the repository at this point in the history
I'm often just iterating on the OSTree content itself and don't require
new images. In such cases, it's a waste of time to wait for images to be
generated when all I want is the treecompose. But using
`coreos-assembler build` is still more convenient than dropping down to
`rpm-ostree compose tree`, especially with the virtualization wrapper.

Add a new `--ostree-only` option in which we only generate a commit to
the OSTree repo. This is a natural extension of coreos#302. Crucially though,
we still create a build directory under `builds/` with metadata about
the built commit. The only practical difference is that there are no
image files and no subkeys under `images` in `meta.json`.

(I didn't bother breaking the idempotency coupling here wrt the
kickstart since (1) it's going away, and (2) this is really just for the
local dev case where you're iterating on the tools, like rpm-ostree, or
the content, like the treefile.)
  • Loading branch information
jlebon committed Feb 12, 2019
1 parent 7812b8a commit 118792a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ dn=$(dirname "$0")
print_help() {
cat 1>&2 <<'EOF'
Usage: coreos-assembler build --help
coreos-assembler build [--force] [--skip-prune] [IMAGETYPES]
coreos-assembler build [--force] [--skip-prune] [--ostree-only] [IMAGETYPES]
Build OSTree and image artifacts from previously fetched packages.
The IMAGETYPES argument is a list of image types; if unspecified it defaults
to "qemu".
to "qemu" unless --ostree-only is provided.
Valid image types:
Expand All @@ -25,8 +25,9 @@ EOF
# Parse options
FORCE=
SKIP_PRUNE=0
OSTREE_ONLY=0
rc=0
options=$(getopt --options hf --longoptions help,force,force-nocache,skip-prune -- "$@") || rc=$?
options=$(getopt --options hf --longoptions help,force,force-nocache,ostree-only,skip-prune -- "$@") || rc=$?
[ $rc -eq 0 ] || {
print_help
exit 1
Expand All @@ -44,6 +45,9 @@ while true; do
--skip-prune)
SKIP_PRUNE=1
;;
--ostree-only)
OSTREE_ONLY=1
;;
--)
shift
break
Expand All @@ -61,14 +65,18 @@ done

declare -a IMAGE_TYPES
IMAGE_TYPES=()
# shellcheck disable=SC2068
for itype in $@; do
IMAGE_TYPES+=("$itype")
done
if [ "${#IMAGE_TYPES[@]}" == 0 ]; then
IMAGE_TYPES=(qemu)
if [ "${OSTREE_ONLY}" == 1 ] && [ $# -ne 0 ]; then
fatal "$0: can't specify image types with --ostree-only"
elif [ "${OSTREE_ONLY}" == 0 ]; then
# shellcheck disable=SC2068
for itype in $@; do
IMAGE_TYPES+=("$itype")
done
if [ "${#IMAGE_TYPES[@]}" == 0 ]; then
IMAGE_TYPES=(qemu)
fi
echo "Image types: ${IMAGE_TYPES[*]}"
fi
echo "Image types: ${IMAGE_TYPES[*]}"

export LIBGUESTFS_BACKEND=direct

Expand Down

0 comments on commit 118792a

Please sign in to comment.