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 global ldflags #1304

Closed
nmittler opened this issue May 10, 2024 · 0 comments · Fixed by #1314
Closed

feat: Add global ldflags #1304

nmittler opened this issue May 10, 2024 · 0 comments · Fixed by #1314

Comments

@nmittler
Copy link
Contributor

When creating images for multiple builds (e.g. in a monorepo), the ldflags would have to be duplicated in each build in .ko.yaml. This creates a lot of boilerplate and potential for inconsistencies, etc.

Instead, a better experience would be to allow a global set of ldflags that will automatically be applied to each build as their generated. Additionally, they can have all the same template parameters that you would have under the build section, since they will be re-evaluated for each build.

There is one choice to make that comes to mind, however:

  • defaultLDFlags: This naming would be in keeping with some other values, like defaultBaseImage. In this case, they would be a default that would simply be replaced if ldflags were specified for a particular binary.
  • ldflags: In this case, they're simply globally ldfags that would always be prepended to any per-build ldflags.

I think I'm fine either way. Happy to discuss.

Also, I'm happy to do the work and send a PR if folks think this is a good idea.

@nmittler nmittler changed the title Add global ldflags feat: Add global ldflags May 10, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
imjasonh pushed a commit that referenced this issue May 15, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant