Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --force-image flag to cosa build #767

Merged
merged 1 commit into from
Sep 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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