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

cli: Correctly no-op unchanged updates #170

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,14 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
let staged_unchanged = staged_digest
.map(|d| d == fetched_digest)
.unwrap_or_default();
let booted_unchanged = booted_image
.as_ref()
.map(|img| img.manifest_digest.as_str() == fetched_digest)
.unwrap_or_default();
if staged_unchanged {
println!("Staged update present, not changed.");
} else if booted_unchanged {
println!("No update available.")
} else {
let osname = booted_deployment.osname();
crate::deploy::stage(sysroot, &osname, &fetched, &spec).await?;
Expand Down
5 changes: 5 additions & 0 deletions tests/kolainst/basic
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
echo "booted into $image"
echo "ok status test"

test "null" = $(jq '.status.staged' < status.json)
# Should be a no-op
bootc update
test "null" = $(jq '.status.staged' < status.json)

test '!' -w /usr
bootc usroverlay
test -w /usr
Expand Down
Loading