Skip to content

Commit 10749bd

Browse files
authored
feat(librarian): allow update-image to be a no-op (#2807)
The update-image command is really useful for container authors, in terms of checking performance, behavior, and configuration. It's useful to be able to run it even without a new image - because if everything is in a steady state, we shouldn't see any changes at all. We still log that the image is the same, but don't count it as an error.
1 parent fa24925 commit 10749bd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

internal/librarian/update_image.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ func (r *updateImageRunner) run(ctx context.Context) error {
108108
}
109109

110110
if r.image == r.state.Image {
111-
slog.Info("no update to the image, aborting.")
112-
return nil
111+
slog.Info("no update to the image; assuming diagnostic run")
113112
}
114113

115114
r.state.Image = r.image

internal/librarian/update_image_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ func TestUpdateImageRunnerRun(t *testing.T) {
255255
imagesClient: &mockImagesClient{},
256256
ghClient: &mockGitHubClient{},
257257
wantFindLatestCalls: 0,
258-
wantGenerateCalls: 0,
258+
wantGenerateCalls: 1,
259259
wantBuildCalls: 0,
260-
wantCheckoutCalls: 0,
260+
wantCheckoutCalls: 2,
261261
},
262262
{
263263
name: "finds latest image",

0 commit comments

Comments
 (0)