Skip to content

feat(ko): allow configuration of local domain to allow publishing to other local registries (e.g. kind)#5809

Merged
caarlos0 merged 9 commits intogoreleaser:mainfrom
markussiebert:feat/ko-local-domain
Jun 6, 2025
Merged

feat(ko): allow configuration of local domain to allow publishing to other local registries (e.g. kind)#5809
caarlos0 merged 9 commits intogoreleaser:mainfrom
markussiebert:feat/ko-local-domain

Conversation

@markussiebert
Copy link
Copy Markdown
Contributor

@markussiebert markussiebert commented Jun 5, 2025

If applied, this commit will make the localDomain for ko builds configurable and add tests for the new configuration option.

This change allows users to specify a custom localDomain for ko builds, increasing flexibility for local image publishing scenarios.

https://ko.build/configuration/#local-publishing-options

closes https://github.com/orgs/goreleaser/discussions/5808

@pull-request-size pull-request-size Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 5, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.95%. Comparing base (f24f4d8) to head (e2c9cef).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5809   +/-   ##
=======================================
  Coverage   82.94%   82.95%           
=======================================
  Files         163      163           
  Lines       16310    16316    +6     
=======================================
+ Hits        13529    13535    +6     
  Misses       2190     2190           
  Partials      591      591           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@caarlos0 caarlos0 added the enhancement New feature or request label Jun 5, 2025
@caarlos0 caarlos0 requested a review from Copilot June 5, 2025 12:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a configurable local_domain option for ko builds, updating schemas, documentation, config, and build logic to support custom local registry domains, along with extending tests for the new field.

  • Add local_domain to JSON schemas and Go config struct
  • Document local_domain usage in customization guide
  • Implement default/fallback logic in build pipeline and extend tests

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
www/docs/static/schema.json Add local_domain property to the JSON schema
www/docs/static/schema-pro.json Add local_domain property to the Pro JSON schema
www/docs/customization/ko.md Document the new local_domain configuration option
pkg/config/config.go Add LocalDomain field to the Ko struct
internal/pipe/ko/ko.go Use LocalDomain from config with default fallback logic
internal/pipe/ko/ko_test.go Extend test struct to include LocalDomain
Comments suppressed due to low confidence (1)

internal/pipe/ko/ko_test.go:194

  • Add a test case that sets a non-default LocalDomain value to verify that the custom domain is correctly applied during publishing.
LocalDomain         string

Comment thread internal/pipe/ko/ko.go Outdated
return fmt.Errorf("build: %w", err)
}

localDomain := "goreleaser.ko.local"
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the default local domain literal into a constant to avoid duplication and make future updates easier.

Suggested change
localDomain := "goreleaser.ko.local"
localDomain := defaultLocalDomain

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

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

thanks for the PR!

proposed one small docs change.

also, maybe worth adding a test for the local domain as well?

Comment thread www/docs/customization/ko.md Outdated
markussiebert and others added 3 commits June 5, 2025 16:23
@pull-request-size pull-request-size Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 5, 2025
@markussiebert
Copy link
Copy Markdown
Contributor Author

I added a focused test for the new logic instead of testing the entire doBuild function, as there are currently no existing tests asserting for it.

@caarlos0 caarlos0 merged commit c344780 into goreleaser:main Jun 6, 2025
17 checks passed
@caarlos0
Copy link
Copy Markdown
Member

caarlos0 commented Jun 6, 2025

Thank you! <3

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/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants