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

[chore] Refactor goreleaser config generation for distributions #797

Open
wants to merge 55 commits into
base: main
Choose a base branch
from

Conversation

douglascamata
Copy link
Contributor

This PR will split off of #795.

This moves the code for generating the goreleaser configuration for the distros into a more declarative and easy-to-extend form.

Why so many changes? 😱

I am completely aware that it represents a big rewrite of this part of code. I tried a few different approaches with the intent of having a minimum change that would allow me to support Windows, but the amount of changes needed always ended up snowballing quickly. Some examples of the reasons for this "snowballing" of code are (non-exhaustive list):

  • Handling arm vs arm/v7.
  • "Build-only" distro for core distro.

This might not the best code for this job too, but at least I believe it sets up a good structure that we can build upon and iterate on to improve.

I'm very open to hear your feedback and see how we can move this forward!

I can join the Collector SIG call on 2025-01-15 to talk about this if any maintainer finds it more productive.

Questions ⍰

If anyone, please, could help me out in testing that release process works fine with the update goreleaser configuration, it would be aaaaamazing! I don't feel super confident without testing this, of course.

@douglascamata
Copy link
Contributor Author

@mowies I think I handled all the feedback you gave so far. I will refrain from anything that would require a forced-push from now on so that reviews become easier as you can use the "commits since your last review" feature. Thank you very much for your time and review. 🙇

By the way, I was about to unexport everything that is unnecessarily exported (that's everything except the BuildDist function). But I thought that this is not super important and the PR is already big enough. There might be other additional improvements/refactors to the remaining code that can be done at a later time.

@mowies
Copy link
Member

mowies commented Jan 23, 2025

@mowies I think I handled all the feedback you gave so far. I will refrain from anything that would require a forced-push from now on so that reviews become easier as you can use the "commits since your last review" feature. Thank you very much for your time and review. 🙇

cool, i'll take another look now

By the way, I was about to unexport everything that is unnecessarily exported (that's everything except the BuildDist function). But I thought that this is not super important and the PR is already big enough. There might be other additional improvements/refactors to the remaining code that can be done at a later time.

that's good, let's rather have a few follow up PRs :)

Copy link
Member

@mowies mowies left a comment

Choose a reason for hiding this comment

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

LGTM! I still think you could move all/most interfaces and structs to the top of the file but that's mostly just my taste.
Additional follow ups that I see:

  • moving things into separate files where it makes sense

A full test release in your fork would be good to verify that everything works and that the same amount of release assets is produced in the end

cmd/goreleaser/internal/configure.go Outdated Show resolved Hide resolved
@douglascamata
Copy link
Contributor Author

@mowies I solved your last pending feedback and completed the release test in my fork.

I tested releasing v0.118.0 (see https://github.com/douglascamata/opentelemetry-collector-releases/tags.). The release is available at https://github.com/douglascamata/opentelemetry-collector-releases/releases/tag/v0.118.0.

Currently running my fork-built Collector in kind without any issues. The amount of artifacts produced by my fork matches the official's (452 in total).

I think this is looking good.

Regarding the follow ups, I can and want to split this into multiple files organize it even better. I also plan to removed any unnecessaraly exported symbols and, last but not least, proceed with the work to add Windows container images. There are some nice adventures to come. :)

Copy link
Member

@mowies mowies left a comment

Choose a reason for hiding this comment

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

LGTM!

@douglascamata
Copy link
Contributor Author

Let's only merge this after the release 0.119.0 goes out well... just for safety purposes. :D

mowies and others added 4 commits February 10, 2025 09:26
Also added the ppc64/power8 arch.
…a/opentelemetry-collector-releases into refactor-go-releaser-config
…tor-releases into refactor-go-releaser-config
@douglascamata
Copy link
Contributor Author

douglascamata commented Feb 12, 2025

@mowies I just rebased this to pick up the changes from #779. The thing is that now I'm not sure about how many release artifacts there should be for testing the release on my fork. 🤔

@mowies
Copy link
Member

mowies commented Feb 12, 2025

nothing should have changed in terms of artifacts, so you should still have the same number of artifacts now

@mowies mowies requested a review from a team as a code owner February 13, 2025 06:58
@mowies
Copy link
Member

mowies commented Feb 13, 2025

@douglascamata did you already test your branch again?
i wanna get this in asap

goos:
- linux
goarch:
- amd64
- arm64
- ppc64le
- s390x
goppc64:
Copy link
Member

Choose a reason for hiding this comment

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

this should still be there i believe

Comment on lines +302 to +310
// func (b *distributionBuilder) WithBuildOnlyPackaging() *distributionBuilder {
// return b.WithOnlyBinArchive().
// WithDefaultChecksum().
// WithDefaultNfpms().
// WithDefaultMSIConfig().
// WithDefaultSigns().
// WithDefaultDockerSigns().
// WithDefaultSBOMs()
// }
Copy link
Member

Choose a reason for hiding this comment

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

what's the plan with this? 😄

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 this pull request may close these issues.

4 participants