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

Allow comma-separated list of platforms #259

Merged
merged 8 commits into from
Dec 22, 2020

Conversation

jonjohnsonjr
Copy link
Collaborator

@jonjohnsonjr jonjohnsonjr commented Dec 7, 2020

Fixes #253

Fixes #274

$ ko publish -B --platform=linux/amd64,linux/arm64 ./cmd/ko/
2020/12/07 13:57:20 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/cmd/ko
2020/12/07 13:57:21 Building github.com/google/ko/cmd/ko for linux/amd64
2020/12/07 13:57:25 Building github.com/google/ko/cmd/ko for linux/arm64
2020/12/07 13:57:29 Publishing gcr.io/jonjohnson-test/ko/ko:latest
2020/12/07 13:57:30 existing blob: sha256:72164b581b02b1eb297b403bcc8fc1bfa245cb52e103a3a525a0835a58ff58e2
2020/12/07 13:57:30 existing blob: sha256:e59bd8947ac7af2c8f4403b183326986ab554bbc262739cf5d9d596c7c7a3aca
2020/12/07 13:57:31 pushed blob: sha256:314bd22f324d73c81d23dd94a14e3a4df6a591381e39b9164163208115c23ae4
2020/12/07 13:57:33 pushed blob: sha256:dd714425e64113dddc2cf7a21a1b7f47c20ae29dc2072284b64fe1e7b82a5307
2020/12/07 13:57:33 gcr.io/jonjohnson-test/ko/ko@sha256:cb6a0c6cb99e6c7b1d7dfd598484d0d25b74e15a69837f3d87c08c58ee7f88e2: digest: sha256:cb6a0c6cb99e6c7b1d7dfd598484d0d25b74e15a69837f3d87c08c58ee7f88e2 size: 751
2020/12/07 13:57:34 existing blob: sha256:72164b581b02b1eb297b403bcc8fc1bfa245cb52e103a3a525a0835a58ff58e2
2020/12/07 13:57:34 existing blob: sha256:d34b09c140e4b67f2c6214e24f26a68bc6b17c28d42f0dda89db38ad03488416
2020/12/07 13:57:35 pushed blob: sha256:99af2cd1b289d3a47aba52934e2ac8c4037e92563e8a4d119b5d0e040f5b9ed3
2020/12/07 13:57:37 pushed blob: sha256:052d3194d06e9194d60e7dcdce4c7d8e91df952f34dfddd461ce181732342db2
2020/12/07 13:57:37 gcr.io/jonjohnson-test/ko/ko@sha256:ca19f1aa2adc983e55c1eb7d6af1ed8574991ff6762eccec8ef7b5e5d965d1ce: digest: sha256:ca19f1aa2adc983e55c1eb7d6af1ed8574991ff6762eccec8ef7b5e5d965d1ce size: 751
2020/12/07 13:57:38 gcr.io/jonjohnson-test/ko/ko:latest: digest: sha256:03ed41dd8676e9988fb4958366cf8d38fbb39e576d5b09bb1cc108c937e6d7ff size: 529
2020/12/07 13:57:38 Published gcr.io/jonjohnson-test/ko/ko@sha256:03ed41dd8676e9988fb4958366cf8d38fbb39e576d5b09bb1cc108c937e6d7ff
gcr.io/jonjohnson-test/ko/ko@sha256:03ed41dd8676e9988fb4958366cf8d38fbb39e576d5b09bb1cc108c937e6d7ff

@codecov-io
Copy link

codecov-io commented Dec 7, 2020

Codecov Report

Merging #259 (f7ff6cc) into master (5b08b05) will increase coverage by 1.20%.
The diff coverage is 68.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #259      +/-   ##
==========================================
+ Coverage   37.06%   38.27%   +1.20%     
==========================================
  Files          33       33              
  Lines        1465     1505      +40     
==========================================
+ Hits          543      576      +33     
- Misses        833      838       +5     
- Partials       89       91       +2     
Impacted Files Coverage Δ
pkg/commands/config.go 16.17% <0.00%> (+0.89%) ⬆️
pkg/commands/resolver.go 11.93% <0.00%> (-0.50%) ⬇️
pkg/build/gobuild.go 61.24% <88.23%> (+3.01%) ⬆️
pkg/build/options.go 85.71% <100.00%> (+2.38%) ⬆️

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 5b08b05...f7ff6cc. Read the comment docs.

@imjasonh
Copy link
Member

imjasonh commented Dec 8, 2020

Can you include README.md in this change?

In particular, what happens if I pass ko resolve --platform=A,B and some of the images built in the process support both platforms while some only support one or the other (or neither).

@jonjohnsonjr
Copy link
Collaborator Author

Will do -- also want to fix the TODO in there, but wanted to hack something together to play with the UX.

@jonjohnsonjr
Copy link
Collaborator Author

PTAL, cc @mattmoor

pkg/build/gobuild_test.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Comment on lines 96 to 97
platform: gbo.platform,
parsedPlatform: parsed,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feels like we've got a datastructure we're hiding in a couple fields of gobuild. Should we create a little PlatformMatcher that we build from the string, which captures this state and surfaces methods for matching a platform?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, kind of. Not sure if we need this anywhere else, so didn't expose it.

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@mattmoor
Copy link
Collaborator

@googlebot I consent!

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@mattmoor
Copy link
Collaborator

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@jonjohnsonjr
Copy link
Collaborator Author

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Dec 21, 2020

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@jonjohnsonjr
Copy link
Collaborator Author

2020/12/21 21:57:23 error creating builder: error setting up builder options: cannot use --platform with GOOS="linux"

This failed in the way I wanted it to, wdyt @mattmoor

@google-cla google-cla bot added cla: no and removed cla: yes labels Dec 22, 2020
@google-cla
Copy link

google-cla bot commented Dec 22, 2020

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

Copy link
Collaborator

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Seems fine to me. --platform is the future :)

@jonjohnsonjr jonjohnsonjr merged commit 7e32453 into ko-build:master Dec 22, 2020
@jonjohnsonjr jonjohnsonjr deleted the platforms branch December 22, 2020 00:53
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.

--platform doesn't work if GOOS and GOARCH are set Feature request - option to publish N architectures
5 participants