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

feat: add ko support #3653

Merged
merged 34 commits into from
Jan 17, 2023
Merged

feat: add ko support #3653

merged 34 commits into from
Jan 17, 2023

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Dec 21, 2022

continuing the PR by @developer-guy

  • should be a publisher, as it does publish the images it builds every time
  • Default method does not work
  • the fromConfig thing should probably be on the defaults, too
  • wire --skip-ko
  • documentation
  • more tests
  • use same registry as docker tests does
  • see if we can make the log output match goreleaser's
  • ??

closes #2556
closes #3490

actions-user and others added 3 commits December 19, 2022 10:28
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 21, 2022
@vercel vercel bot temporarily deployed to Preview December 21, 2022 02:33 Inactive
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview December 21, 2022 02:35 Inactive
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

Merging #3653 (2d2649d) into main (48f77f9) will increase coverage by 0.09%.
The diff coverage is 87.64%.

@@            Coverage Diff             @@
##             main    #3653      +/-   ##
==========================================
+ Coverage   83.60%   83.70%   +0.09%     
==========================================
  Files         118      119       +1     
  Lines        9963    10214     +251     
==========================================
+ Hits         8330     8550     +220     
- Misses       1316     1338      +22     
- Partials      317      326       +9     
Impacted Files Coverage Δ
internal/pipe/publish/publish.go 78.57% <ø> (ø)
pkg/config/config.go 95.21% <ø> (ø)
pkg/context/context.go 100.00% <ø> (ø)
internal/pipe/ko/ko.go 86.46% <86.46%> (ø)
cmd/release.go 100.00% <100.00%> (ø)
internal/testlib/docker.go 72.97% <100.00%> (+31.79%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview December 21, 2022 02:48 Inactive
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview December 21, 2022 02:50 Inactive
@caarlos0 caarlos0 added the enhancement New feature or request label Dec 21, 2022
@caarlos0 caarlos0 added this to the v1.14.0 milestone Dec 21, 2022
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview December 21, 2022 03:18 Inactive
@vercel vercel bot temporarily deployed to Preview December 21, 2022 03:41 Inactive
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Dec 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
goreleaser 🔄 Building (Inspect) Dec 21, 2022 at 3:42AM (UTC)

@vercel vercel bot temporarily deployed to Preview December 21, 2022 03:43 Inactive
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview December 29, 2022 02:43 Inactive
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 29, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2d2649d
Status: ✅  Deploy successful!
Preview URL: https://996396f5.goreleaser.pages.dev
Branch Preview URL: https://feature-2556.goreleaser.pages.dev

View logs

@vercel vercel bot temporarily deployed to Preview December 29, 2022 16:21 Inactive
@caarlos0
Copy link
Member Author

hey @developer-guy, can you take a look? especially the docs (https://feature-2556.goreleaser.pages.dev/customization/ko/)

Copy link
Contributor

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for keeping this moving. Just a few smallish comments.


```yaml
# .goreleaser.yaml
kos:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be ko: instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's pluralized because it can be multiple KO configurations... is the pluralization a problem? If it is, I can change...

Copy link
Member

Choose a reason for hiding this comment

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

We could build an OCI image with ko for different binaries built from the same repository, which is why I designed it that way.

www/docs/customization/ko.md Outdated Show resolved Hide resolved
@@ -916,6 +935,7 @@ type Project struct {
Brews []Homebrew `yaml:"brews,omitempty" json:"brews,omitempty"`
AURs []AUR `yaml:"aurs,omitempty" json:"aurs,omitempty"`
Krews []Krew `yaml:"krews,omitempty" json:"krews,omitempty"`
Kos []Ko `yaml:"kos,omitempty" json:"kos,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Kos []Ko `yaml:"kos,omitempty" json:"kos,omitempty"`
Ko []Ko `yaml:"ko,omitempty" json:"ko,omitempty"`

}

if ko.BaseImage == "" {
ko.BaseImage = chainguardStatic
Copy link
Contributor

Choose a reason for hiding this comment

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

We should try to reuse whatever const ko defines upstream, in case we ever change the default base image in a future ko release.

Luckily @developer-guy has already started toward that in ko-build/ko#904, which we can reuse here when ko.BaseImage is not defined by the user.

Copy link
Member

Choose a reason for hiding this comment

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

yep, totally agree

Copy link
Member Author

Choose a reason for hiding this comment

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

not merged/released yet, right? we can change this in the future then

Copy link
Member

Choose a reason for hiding this comment

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

yep, it is not released yet, it is waiting for merge right now

Comment on lines +99 to +109
if len(ko.Platforms) == 0 {
ko.Platforms = []string{"linux/amd64"}
}

if len(ko.Tags) == 0 {
ko.Tags = []string{"latest"}
}

if ko.SBOM == "" {
ko.SBOM = "spdx"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these should also be defaults that ko maintains upstream. If we ever change them in the future we don't want to have to go hunting for other places these have been set downstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

cool, I can PR those there too

caarlos0 and others added 5 commits January 11, 2023 09:42
Co-authored-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member Author

TestPublishPipeError/publish_fail started failing and I have no idea why... @imjasonh @developer-guy any guesses? It should fail to publish to a fake registry, but always succeeds, you can even see the log from KO:

CleanShot 2023-01-16 at 00 53 02@2x

I don't understand why it could succeed...

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
@developer-guy
Copy link
Member

developer-guy commented Jan 16, 2023

TestPublishPipeError/publish_fail started failing and I have no idea why... @imjasonh @developer-guy any guesses? It should fail to publish to a fake registry, but always succeeds, you can even see the log from KO:

CleanShot 2023-01-16 at 00 53 02@2x

I don't understand why it could succeed...

I found the problem and fixed it with cd78015.

PTAL @caarlos0

@caarlos0
Copy link
Member Author

ahh good catch @developer-guy , I knew it must be something "easy" that I was missing

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@developer-guy
Copy link
Member

I've open a PR to fix this problem in ko project side: ko-build/ko#932

@caarlos0
Copy link
Member Author

I did a few changes in your commit too, let me know what you think @developer-guy

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member Author

update docs, fixed the main (was being ignored :kek:), I think we are good to merge now!

@caarlos0 caarlos0 merged commit 2450746 into main Jan 17, 2023
@caarlos0 caarlos0 deleted the feature/2556 branch January 17, 2023 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: add google/ko as brand new builder engine for building and pushing container images
4 participants