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

Add ko extract to extract ko-built image references from rendered YAML #443

Closed
wants to merge 1 commit into from

Conversation

imjasonh
Copy link
Member

@mattmoor @jonjohnsonjr

Tekton currently does this with a custom-built Python script, koparse, and first-party support in ko itself could be useful.

@google-cla google-cla bot added the cla: yes label Sep 20, 2021
@imjasonh
Copy link
Member Author

#406
#358 (comment)

@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2021

Codecov Report

Merging #443 (d5415e8) into main (2dced74) will decrease coverage by 0.47%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
- Coverage   53.25%   52.78%   -0.48%     
==========================================
  Files          37       38       +1     
  Lines        1842     1887      +45     
==========================================
+ Hits          981      996      +15     
- Misses        710      739      +29     
- Partials      151      152       +1     
Impacted Files Coverage Δ
pkg/commands/extract.go 31.81% <31.81%> (ø)
pkg/commands/commands.go 76.92% <100.00%> (+1.92%) ⬆️

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 2dced74...d5415e8. Read the comment docs.

@jonjohnsonjr
Copy link
Collaborator

I feel like it might be more useful to have a flag where ko can spit out anything it builds? I think skaffold does something similar with --file-output.

Doing this with a resolved yaml file means we'll pick up anything in KO_DOCKER_REPO, not just things that we built.

@imjasonh
Copy link
Member Author

I feel like it might be more useful to have a flag where ko can spit out anything it builds? I think skaffold does something similar with --file-output.

Doing this with a resolved yaml file means we'll pick up anything in KO_DOCKER_REPO, not just things that we built.

That would be fine too, we'd just need to settle on an output format. OCI layout? Newline-delimited image refs@digest?

ko extract as it is in this PR is imperfect, sure, but it would do everything we need for Tekton and Knative (I think) -- I can't think of a use case where someone would have other KO_DOCKER_REPO-prefixed strings in their YAML that we shouldn't report. Maybe we could have ko resolve emit fully-qualified registry URLs to prevent the KO_DOCKER_REPO=username case, which could lead to trouble here.

We could document its limitations a bit better, if that's a concern.

@jonjohnsonjr
Copy link
Collaborator

We could document its limitations a bit better, if that's a concern.

Yeah this is my main issue. The command is fine, we should just be more transparent about what it's doing.

@imjasonh
Copy link
Member Author

imjasonh commented Oct 7, 2021

Closing this until it can be rebased on #453

@imjasonh imjasonh closed this Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants