Skip to content

Commit

Permalink
Add --force-image flag to cosa build
Browse files Browse the repository at this point in the history
Adds the force-image flag to rebuild the image and disregard input checks.
This is useful to just build an image and not the ostree using --force
  • Loading branch information
Prashanth684 authored and jlebon committed Sep 20, 2019
1 parent 11c11da commit 3e134ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dn=$(dirname "$0")
print_help() {
cat 1>&2 <<'EOF'
Usage: coreos-assembler build --help
coreos-assembler build [--force] [--skip-prune] [--version VERSION] [TARGET...]
coreos-assembler build [--force] [--force-image] [--skip-prune] [--version VERSION] [TARGET...]
Build OSTree and image base artifacts from previously fetched packages.
Accepted TARGET arguments:
Expand All @@ -24,11 +24,12 @@ EOF

# Parse options
FORCE=
FORCE_IMAGE=
SKIP_PRUNE=0
VERSION=
PARENT=
rc=0
options=$(getopt --options hf --longoptions help,force,version:,parent:,force-nocache,skip-prune -- "$@") || rc=$?
options=$(getopt --options hf --longoptions help,force,version:,parent:,force-nocache,force-image,skip-prune -- "$@") || rc=$?
[ $rc -eq 0 ] || {
print_help
exit 1
Expand All @@ -43,6 +44,9 @@ while true; do
-f | --force | --force-nocache)
FORCE="--force-nocache"
;;
--force-image)
FORCE_IMAGE=1
;;
--skip-prune)
SKIP_PRUNE=1
;;
Expand Down Expand Up @@ -223,7 +227,8 @@ else
# Note we may not actually have a previous build in the case of
# successfully composing an ostree but failing the image on the
# first build.
if [ -n "${previous_build}" ] && [ "${image_input_checksum}" = "${previous_image_input_checksum}" ]; then
# FORCE_IMAGE forces a build even if there were no ostree changes
if [ -z "$FORCE_IMAGE" ] && [ -n "${previous_build}" ] && [ "${image_input_checksum}" = "${previous_image_input_checksum}" ]; then
echo "No changes in image inputs."
# But still run through the follow-up targets. This allows us to have
# e.g. `cosa build metal` be idempotent even if the initial build failed
Expand Down

0 comments on commit 3e134ca

Please sign in to comment.