Skip to content

Conversation

@jlebon
Copy link
Member

@jlebon jlebon commented Sep 16, 2025

Use the new inputhash label to tell if there was a meaningful change since the previous build. If not, just no-op. Unless --force is passed.

See also: coreos/fedora-coreos-config#3758

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces change detection to skip re-importing builds if the inputs haven't changed, which is a great optimization. However, I've identified two high-severity issues with the current implementation. One can cause the script to fail in a clean environment where no previous builds exist. The other involves faulty comparison logic that could lead to incorrectly skipping a build import. I've provided code suggestions to address both of these problems.

Use the new inputhash label to tell if there was a meaningful change
since the previous build. If not, just no-op. Unless `--force` is
passed.

See also: coreos/fedora-coreos-config#3758
Comment on lines +215 to +224
if [ -z "$FORCE" ]; then
skip_import=1
else
echo "Importing new build anyway (--force)"
fi
fi

if [ -z "${skip_import:-}" ]; then
/usr/lib/coreos-assembler/cmd-import "${final_ref}" ${SKIP_PRUNE:+--skip-prune}
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be written more succinctly?

        if [ -n "$FORCE" ]; then
            echo "Importing new build anyway (--force)"
            /usr/lib/coreos-assembler/cmd-import "${final_ref}" ${SKIP_PRUNE:+--skip-prune}
        fi
    fi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to import if hashes don't match.

Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jlebon jlebon merged commit 0637540 into coreos:main Sep 19, 2025
5 of 6 checks passed
@jlebon jlebon deleted the pr/no-op-inputhash branch September 19, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants