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

fix(ko): Do not print image name to stdout #6928

Merged

Conversation

halvards
Copy link
Contributor

@halvards halvards commented Dec 3, 2021

With this change, the ko builder no longer prints the image name to stdout by default.

Originally, this was added to the ko builder to mimic the behavior of the ko CLI. Other Skaffold image builders do not print the image name in this way.

The reason this is useful for existing ko CLI users is that some documented workflows rely on capturing the image name from stdout, see https://github.com/google/ko/blob/v0.9.3/README.md#build-an-image.

After some investigation, the better option seems to be to rely on the existing --quiet and --output Skaffold flags to format the output of the image name(s).

This change also updates the ko builder documentation to show existing ko CLI users how to capture the image name by providing an appropriate Go template to --output.

Fixes: #6835
Closes: #6836
Tracking: #6041

@halvards halvards requested a review from a team as a code owner December 3, 2021 06:28
@google-cla google-cla bot added the cla: yes label Dec 3, 2021
@halvards halvards added the kokoro:run runs the kokoro jobs on a PR label Dec 3, 2021
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Dec 3, 2021
@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #6928 (4a34ec7) into main (290280e) will decrease coverage by 1.33%.
The diff coverage is 61.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6928      +/-   ##
==========================================
- Coverage   70.48%   69.14%   -1.34%     
==========================================
  Files         515      547      +32     
  Lines       23150    25065    +1915     
==========================================
+ Hits        16317    17332    +1015     
- Misses       5776     6572     +796     
- Partials     1057     1161     +104     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/deploy.go 52.00% <ø> (-1.85%) ⬇️
cmd/skaffold/app/cmd/dev.go 84.61% <0.00%> (ø)
cmd/skaffold/app/cmd/flags.go 91.00% <0.00%> (+0.18%) ⬆️
cmd/skaffold/app/cmd/render.go 36.66% <0.00%> (-4.72%) ⬇️
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/fix.go 68.85% <40.00%> (-7.62%) ⬇️
cmd/skaffold/app/cmd/lint.go 42.85% <42.85%> (ø)
cmd/skaffold/app/cmd/find_configs.go 48.88% <50.00%> (+0.24%) ⬆️
cmd/skaffold/app/skaffold.go 76.19% <70.00%> (-8.43%) ⬇️
... and 165 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update feafa43...4a34ec7. Read the comment docs.

With this change, the `ko` builder no longer prints the image name to
`stdout` by default.

Originally, this was added to the `ko` builder to mimic the behavior of
the `ko` CLI. Other Skaffold image builders do not print the image name
in this way.

The reason this is useful for existing `ko` CLI users is that some
documented workflows rely on capturing the image name from `stdout`, see
https://github.com/google/ko/blob/v0.9.3/README.md#build-an-image

After some investigation, the better option seems to be to rely on the
existing `--quiet` and `--output` Skaffold flags to format the output of
the image name(s).

This change also updates the `ko` builder documentation to show existing
`ko` CLI users how to capture the image name by providing an appropriate
Go template to `--output`.

Fixes: GoogleContainerTools#6835
Closes: GoogleContainerTools#6836
Tracking: GoogleContainerTools#6041
@halvards halvards force-pushed the ko-no-image-name-output branch from 373c210 to 4a34ec7 Compare December 3, 2021 07:03
@halvards halvards added the kokoro:force-run forces a kokoro re-run on a PR label Dec 3, 2021
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Dec 3, 2021
Copy link
Contributor

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

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

LGTM

@MarlonGamez MarlonGamez merged commit ff0620d into GoogleContainerTools:main Dec 7, 2021
@halvards halvards deleted the ko-no-image-name-output branch December 22, 2021 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ko builder sideload displays both correct and incorrect tag when using default tag policy
4 participants