Skip to content

Conversation

@tianon
Copy link
Member

@tianon tianon commented Mar 3, 2025

This moves the "normal" deploy output from stdout to stderr so that we can print it all the time (whether it's a dry-run or not), such that dry-run can have the same progress output.

For now, I've decided that "needs-push" means "failure" and printed the status accordingly, but I could be convinced it should do something else instead. (#119 (comment))

Without this, "dry-run" doesn't print any status, especially in the case of 100% "already pushed" (which is the whole reason we implemented dry-run in the first place, so it'd helpful for it to have some output).

@tianon tianon requested a review from a team as a code owner March 3, 2025 23:19
dryRunOut <- j

// TODO this isn't exactly *failure* -- maybe we should just add a logText suffix instead?
fmt.Fprintln(os.Stderr, failurePrefix+logText)
Copy link
Member Author

Choose a reason for hiding this comment

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

A good argument in favor of dropping the TODO here and just accepting that this is failure is that this case is basically "we do need to push, but were blocked by configuration"

Copy link
Member

Choose a reason for hiding this comment

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

I agree that an unpushed image should be considered a failure on dry-run. Should this also exit at the end with an error if there were things needing to be pushed when doing dry-run?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a harder question -- I think it's more useful/easier to use if "non-empty stdout" means something needed to be pushed, since the whole point is querying what did need to be pushed, and a non-zero exit code then makes it harder to differentiate breaking errors vs just "things need to be pushed".

This moves the "normal" deploy output from stdout to stderr so that we can print it all the time (whether it's a dry-run or not), such that dry-run can have the same progress output.

Without this, "dry-run" doesn't print any status, especially in the case of 100% "already pushed" (which is the whole reason we implemented dry-run in the first place, so it'd helpful for it to have *some* output).
@tianon tianon force-pushed the dry-run-progress branch from 69a9d6c to d3a9bdd Compare March 4, 2025 00:45
@yosifkit yosifkit merged commit 000d07c into docker-library:main Mar 4, 2025
1 check passed
@yosifkit yosifkit deleted the dry-run-progress branch March 4, 2025 00:57
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