From 3c51b61d766dc6718b62de4906acc21efad57856 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 15 Mar 2023 13:50:41 +0100 Subject: [PATCH 1/2] auto update: return restart error Return the error when restarting the unit failed during an update. The task is correctly marked to have failed but we really need to return the error to the user. [NO NEW TESTS NEEDED] - The flakes in #17607 will reveal errors. Signed-off-by: Valentin Rothberg --- pkg/autoupdate/autoupdate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go index 2ccc0649c4..10258701f8 100644 --- a/pkg/autoupdate/autoupdate.go +++ b/pkg/autoupdate/autoupdate.go @@ -203,6 +203,9 @@ func (u *updater) updateUnit(ctx context.Context, unit string, tasks []*task) [] // Jump to the next unit on successful update or if rollbacks are disabled. if updateError == nil || !u.options.Rollback { + if updateError != nil { + errors = append(errors, fmt.Errorf("restarting unit %s during update: %w", unit, updateError)) + } return errors } From ba141adce489a0188b91dad36f055607b23b72cc Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 16 Mar 2023 10:04:30 +0100 Subject: [PATCH 2/2] test/system/255-auto-update.bats: add debug logs Add debug logs from systemctl and journalctl in hope to get more data on the Debian flakes tracked in #17796. Signed-off-by: Valentin Rothberg --- test/system/255-auto-update.bats | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats index b9ba7f2ca5..b83025f49b 100644 --- a/test/system/255-auto-update.bats +++ b/test/system/255-auto-update.bats @@ -171,7 +171,15 @@ function _confirm_update() { is "$output" ".* system auto-update" since=$(date --iso-8601=seconds) - run_podman auto-update --rollback=false --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}" + run_podman '?' auto-update --rollback=false --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}" + if [[ $status -ne 0 ]]; then + echo "------------------------------------ SYSTEMCTL STATUS" + systemctl status container-$cname.service + echo "------------------------------------ JOURNALCAL LOGS" + journalctl --unit container-$cname.service + echo "------------------------------------" + die "auto update failed with exit code $status: $output" + fi is "$output" "Trying to pull.*" "Image is updated." is "$output" ".*container-$cname.service,quay.io/libpod/alpine:latest,true,registry.*" "Image is updated." run_podman events --filter type=system --since $since --stream=false @@ -248,7 +256,15 @@ function _confirm_update() { run_podman auto-update --dry-run --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}" is "$output" ".*container-$cname.service,quay.io/libpod/localtest:latest,pending,local.*" "Image update is pending." - run_podman auto-update --rollback=false --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}" + run_podman '?' auto-update --rollback=false --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}" + if [[ $status -ne 0 ]]; then + echo "------------------------------------ SYSTEMCTL STATUS" + systemctl status container-$cname.service + echo "------------------------------------ JOURNALCAL LOGS" + journalctl --unit container-$cname.service + echo "------------------------------------" + die "auto update failed with exit code $status: $output" + fi is "$output" ".*container-$cname.service,quay.io/libpod/localtest:latest,true,local.*" "Image is updated." _confirm_update $cname $ori_image @@ -353,6 +369,11 @@ EOF is "$n_updated" "2" "Number of images updated from registry." for cname in "${!expect_update[@]}"; do + echo "------------------------------------ SYSTEMCTL STATUS" + systemctl status container-$cname.service + echo "------------------------------------ JOURNALCAL LOGS" + journalctl --unit container-$cname.service + echo "------------------------------------" is "$update_log" ".*$cname.*" "container with auto-update policy image updated" # Just because podman says it fetched, doesn't mean it actually updated _confirm_update $cname $img_id