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

✨ use goreleaser for releasing binary #4748

Merged
merged 8 commits into from
Apr 12, 2024
Merged

✨ use goreleaser for releasing binary #4748

merged 8 commits into from
Apr 12, 2024

Conversation

kranurag7
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:

For automating releases.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Fixes: #4391 #4091

Related: #4610 #4309

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests

Release note:

Use goreleaser for releasing binary

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jan 19, 2024
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 19, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @kranurag7. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@richardcase
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 19, 2024
Copy link
Member

@richardcase richardcase 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 this @kranurag7 . I like the use of goreleaser here and creating the draft release.

.github/workflows/release.yaml Outdated Show resolved Hide resolved
.goreleaser.yaml Show resolved Hide resolved
cmd/clusterawsadm/cmd/version/version.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 19, 2024
@richardcase
Copy link
Member

/milestone v2.4.0

@nrb
Copy link
Contributor

nrb commented Feb 1, 2024

This lgtm, but I am not familiar with the release process and therefore don't feel comfortable putting an actual review on this.

@dlipovetsky
Copy link
Contributor

dlipovetsky commented Feb 5, 2024

From today's office hours: We'd like to have more maintainers/reviewers familiar with the current release process before changing this.

/milestone v2.5.0

@k8s-ci-robot k8s-ci-robot modified the milestones: v2.4.0, v2.5.0 Feb 5, 2024
@vincepri
Copy link
Member

vincepri commented Feb 7, 2024

this seems fine to me although I never used goreleaser, for comparison this is what upstream does https://github.com/kubernetes-sigs/cluster-api/blob/main/.github/workflows/release.yaml

Let's wait to cut v2.4.0 then merge this for subsequent releases?

@nrb
Copy link
Contributor

nrb commented Mar 4, 2024

/retest

@nrb
Copy link
Contributor

nrb commented Mar 18, 2024

After going through the v2.4.1 release process, we ran into #4881. Using goreleaser bypasses this.

I tested this with the following process:

gh pr checkout 4748
goreleaser release --snapshot --clean

It created all the binaries faster than the existing Docker method did, along with tarballs including clusterctl-aws and clusterawsadm binaries for every platform.

I'd like for Damiano to take a look at this too, but I think this is worth setting up for at least creating the release and uploading binaries.

We can look at how the release notes and images get built later. I'm guessing we could roll the release notes process into this, but maybe not the image building/promotion.

/lgtm

/assign @damdo

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Mar 18, 2024
@kranurag7
Copy link
Contributor Author

Hey there,
Happy to work on this till completion. Please ask if there's any question on the PR. I'll be responsive :)

I rebased the PR and I created a demo release on my fork.
https://github.com/kranurag7/cluster-api-provider-aws/releases/tag/v2.4.2

Other things like removing binaries existing binaries related make targets, updating release docs etc. can be done in a subsequent PR or even this PR as well.

.goreleaser.yaml Outdated Show resolved Hide resolved
.goreleaser.yaml Show resolved Hide resolved
@nrb
Copy link
Contributor

nrb commented Apr 4, 2024

/hold

Holding because there are some missing artifacts when releasing with this configuration.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 4, 2024
Makefile Outdated Show resolved Hide resolved
* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target

Signed-off-by: Nolan Brubaker <[email protected]>
@nrb
Copy link
Contributor

nrb commented Apr 11, 2024

Updated code incoming, but I was able to successfully create a release with the custom release notes on my fork: https://github.com/nrb/cluster-api-provider-aws/releases/tag/v2.8.0 🎉

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target
* Force goreleaser to use local config
* Set RELEASE_TAG env variable for release notes
* Output env vars for debugging
* Re-enable changelog support

Signed-off-by: Nolan Brubaker <[email protected]>
@nrb
Copy link
Contributor

nrb commented Apr 11, 2024

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 11, 2024
@@ -0,0 +1,64 @@
builds:
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for @richardcase since you asked about it before - the changelog.disabled flag actually disabled posting a changelog/release notes entirely; even customized ones passed via --release-notes. The --release-notes flag is what overrides the Goreleaser changelog generation.

See https://goreleaser.com/customization/changelog/

Copy link
Member

Choose a reason for hiding this comment

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

Noted and understood, thanks @nrb . I mentioned it more in the context that currently the makefile would generate and attach the release notes. But if we are attaching the custom release notes directly with goreleaser then great 👍

Signed-off-by: Nolan Brubaker <[email protected]>
@damdo
Copy link
Member

damdo commented Apr 12, 2024

/retest

Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

/lgtm

/assign @richardcase

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 12, 2024
@damdo damdo requested a review from richardcase April 12, 2024 08:40
@richardcase
Copy link
Member

Great work @kranurag7 and @nrb , this is a real quality of life improvement 🎉

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardcase

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2024
@k8s-ci-robot k8s-ci-robot merged commit 4812465 into kubernetes-sigs:main Apr 12, 2024
19 checks passed
@kranurag7 kranurag7 deleted the kr/use-goreleaser-for-releasing-clusterawsadm branch April 12, 2024 09:14
@nrb
Copy link
Contributor

nrb commented Apr 12, 2024

/cherry-pick release-2.4

The .goreleaser.yaml file needs to be present in the branch when its checked out during the build.

We worked around this for v2.4.2, but the cherry-pick will be useful for releases going forward.

@k8s-infra-cherrypick-robot

@nrb: #4748 failed to apply on top of branch "release-2.4":

Applying: use goreleaser for releasing the binaries
Applying: disable releasing of binaries using make targets
Applying: Update release-binaries target to use goreleaser
Using index info to reconstruct a base tree...
M	hack/tools/go.mod
M	hack/tools/go.sum
Falling back to patching base and 3-way merge...
Auto-merging hack/tools/go.sum
CONFLICT (content): Merge conflict in hack/tools/go.sum
Auto-merging hack/tools/go.mod
CONFLICT (content): Merge conflict in hack/tools/go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Update release-binaries target to use goreleaser
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-2.4

The .goreleaser.yaml file needs to be present in the branch when its checked out during the build.

We worked around this for v2.4.2, but the cherry-pick will be useful for releases going forward.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

nrb added a commit to nrb/cluster-api-provider-aws that referenced this pull request Apr 22, 2024
* use goreleaser for releasing the binaries

Signed-off-by: Anurag <[email protected]>

* disable releasing of binaries using make targets

since we intend to use goreleaser now, we can remove the make targets.
This commit does the same.

Signed-off-by: Anurag <[email protected]>

* Update release-binaries target to use goreleaser

* Add goreleaser as a tool dependency
* Update .goreleaser configuration to upload YAML templates as GitHub
  release artifacts
* Create binaries rather than archives to mimic current uploads.

Signed-off-by: Nolan Brubaker <[email protected]>

* Update documentation and remove unused targets

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove unused gh targets/client

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target
* Force goreleaser to use local config
* Set RELEASE_TAG env variable for release notes
* Output env vars for debugging
* Re-enable changelog support

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove reference to unused steps

Signed-off-by: Nolan Brubaker <[email protected]>

---------

Signed-off-by: Anurag <[email protected]>
Signed-off-by: Nolan Brubaker <[email protected]>
Co-authored-by: Nolan Brubaker <[email protected]>
fad3t pushed a commit to fad3t/cluster-api-provider-aws that referenced this pull request Jul 25, 2024
* use goreleaser for releasing the binaries

Signed-off-by: Anurag <[email protected]>

* disable releasing of binaries using make targets

since we intend to use goreleaser now, we can remove the make targets.
This commit does the same.

Signed-off-by: Anurag <[email protected]>

* Update release-binaries target to use goreleaser

* Add goreleaser as a tool dependency
* Update .goreleaser configuration to upload YAML templates as GitHub
  release artifacts
* Create binaries rather than archives to mimic current uploads.

Signed-off-by: Nolan Brubaker <[email protected]>

* Update documentation and remove unused targets

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove unused gh targets/client

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target
* Force goreleaser to use local config
* Set RELEASE_TAG env variable for release notes
* Output env vars for debugging
* Re-enable changelog support

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove reference to unused steps

Signed-off-by: Nolan Brubaker <[email protected]>

---------

Signed-off-by: Anurag <[email protected]>
Signed-off-by: Nolan Brubaker <[email protected]>
Co-authored-by: Nolan Brubaker <[email protected]>
fad3t pushed a commit to fad3t/cluster-api-provider-aws that referenced this pull request Oct 8, 2024
* use goreleaser for releasing the binaries

Signed-off-by: Anurag <[email protected]>

* disable releasing of binaries using make targets

since we intend to use goreleaser now, we can remove the make targets.
This commit does the same.

Signed-off-by: Anurag <[email protected]>

* Update release-binaries target to use goreleaser

* Add goreleaser as a tool dependency
* Update .goreleaser configuration to upload YAML templates as GitHub
  release artifacts
* Create binaries rather than archives to mimic current uploads.

Signed-off-by: Nolan Brubaker <[email protected]>

* Update documentation and remove unused targets

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove unused gh targets/client

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target

Signed-off-by: Nolan Brubaker <[email protected]>

* Updates based on doing dry runs

* Remove Windows format override
* Move goreleaser invocation into the Makefile
* Add output directory to goreleaser configuration
* Use generated release notes as the release contents
* Run make release target inside the GitHub workflow
* Set expected environment variables in the GitHub workflow
* Build goreleaser before running the release target
* Force goreleaser to use local config
* Set RELEASE_TAG env variable for release notes
* Output env vars for debugging
* Re-enable changelog support

Signed-off-by: Nolan Brubaker <[email protected]>

* Remove reference to unused steps

Signed-off-by: Nolan Brubaker <[email protected]>

---------

Signed-off-by: Anurag <[email protected]>
Signed-off-by: Nolan Brubaker <[email protected]>
Co-authored-by: Nolan Brubaker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish clusteraswadm as clusterctl plugin
9 participants