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 rpk releases #7115

Merged
merged 3 commits into from
Dec 4, 2022

Conversation

ivotron
Copy link
Member

@ivotron ivotron commented Nov 7, 2022

Use goreleaser for creating/publishing RPK binaries. To test locally, install goreleaser and then:

cd src/go/rpk
goreleaser r --rm-dist --snapshot

The --snapshot above makes the build skip notarization for darwin binaries.

fixes #2773
fixes https://github.com/redpanda-data/devprod/issues/443
related to #4191
related to redpanda-data/homebrew-tap#9

Backport Required

  • v22.2.x
  • v22.1.x

Release notes

  • none

@ivotron
Copy link
Member Author

ivotron commented Nov 7, 2022

required secrets have been defined for this repository

@ivotron
Copy link
Member Author

ivotron commented Nov 7, 2022

a GHA job run that tests these changes: https://github.com/ivotron/redpanda/actions/runs/3408138014/jobs/5668439346 . this is running on my fork repo, where I added the same secrets and changed the org references from redpanda-data to ivotron (see ivotron@51d64b0)

I triggered using the v20.0.0 tag (which doesn't exist in this repo). The two main outcomes:

To test the tap:

brew tap ivotron/homebrew-tap

# verify the info
brew info ivotron/tap/redpanda

# on an M1 mac, this will attempt to fetch the arm64 binary
brew install ivotron/tap/redpanda

since the release is marked draft, the messages is:

$ brew install ivotron/tap/redpanda
==> Downloading https://github.com/ivotron/redpanda/releases/download/v20.0.0/rpk_20.0.0_darwin_arm64.tar.gz
curl: (22) The requested URL returned error: 404

Error: redpanda: Failed to download resource "redpanda"
Download failed: https://github.com/ivotron/redpanda/releases/download/v20.0.0/rpk_20.0.0_darwin_arm64.tar.gz

but this shows how the arm64 binary is being referenced

@ivotron
Copy link
Member Author

ivotron commented Nov 7, 2022

I pushed a v20.0.01 tag to my fork and published that release, so that I could install rpk, and the install works fine, meaning the arm64 binary gets installed on my m1, and runs fine. The problem I found is that rpk version shows an empty string. I'll mark this as draft until this gets resolved. However, I would really appreciate reviews for this in its current state, as I don't expect the PR to change drastically (it'll be a small tweak to the goreleaser config).

Comment on lines 23 to 28
fs := afero.NewOsFs()
p := config.Params{ConfigPath: ""}
cfg, err := p.Load(fs)
if err != nil {
log.Fatalf("%s", fmt.Errorf("unable to read the redpanda configuration file: %w", err))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm, this is from #7107, can this be rebased on dev?

Comment on lines 111 to 119
p := path.Join(c.configSourceDir, "redpanda.yaml")
cf, err := os.ReadFile(p)
if err != nil {
log.Fatalf("%s", fmt.Errorf("unable to read the redpanda configuration file: %w", err))
log.Fatalf("%s", fmt.Errorf("unable to read the redpanda configuration file, %q: %w", p, err))
}
cfg := &config.Config{}
err = yaml.Unmarshal(cf, cfg)
if err != nil {
log.Fatalf("%s", fmt.Errorf("unable to parse the redpanda configuration file, %q: %w", p, err))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is from #7107 as well (and the go.mod change)

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, sorry, the rebase is a bit messed up. fixed in the last push

the goreleaser configuration added in this commit defines the following:

- builds for windows and darwin, to replicate the previous github
  actions-based workflow

- homebrew release, which takes care of publishing M1 binaries

- for the darwin build, hooks for signing/notarizing using quill

- github release that replicates the github actions-based workflow for
  uploading rpk binaries as github release artifacts

Signed-off-by: Ivo Jimenez <[email protected]>
  - installs quill instead of gon, as this is what's used now for
    signing/notarization of darwin binaries.
  - moves logic of github/homebrew releases to goreleaser's

Signed-off-by: Ivo Jimenez <[email protected]>
These are now unused.

Signed-off-by: Ivo Jimenez <[email protected]>
@ivotron ivotron force-pushed the use-goreleaser-for-rpk-releases branch from 0e71d97 to c553d8c Compare November 10, 2022 07:08
@github-actions github-actions bot removed the area/k8s label Nov 10, 2022
@ivotron ivotron requested review from rishabh96b and twmb November 10, 2022 07:10
@emaxerrno
Copy link
Contributor

@ivotron what’s the motivation for this change. To create a separate rpk release train ?

@ivotron
Copy link
Member Author

ivotron commented Nov 14, 2022

@ivotron what’s the motivation for this change. To create a separate rpk release train ?

the main goal is to fix #2773. goreleaser takes care of that nicely. As a side effect, it opens the possibility of being able to publish standalone rpk binaries for linux (just add it as a new os/arch combination), as well as for homebrew on linux

@ivotron ivotron merged commit 8f86dee into redpanda-data:dev Dec 4, 2022
@ivotron ivotron deleted the use-goreleaser-for-rpk-releases branch December 4, 2022 12:16
@ivotron
Copy link
Member Author

ivotron commented Dec 4, 2022

/backport v22.3.x

@ivotron
Copy link
Member Author

ivotron commented Dec 9, 2022

/backport v22.2.x

@ivotron
Copy link
Member Author

ivotron commented Dec 9, 2022

/backport v22.1.x

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 529166e03fca50745bbe22c6a2df8c3f5d02ce25 e4f151e8f7061ce23fee2292d497691465d2947e c553d8c5bcca317cb26d17427fa3bac3cd9c7592

Workflow run logs.

@vbotbuildovich
Copy link
Collaborator

Failed to run cherry-pick command. I executed the below command:

git cherry-pick -x 529166e03fca50745bbe22c6a2df8c3f5d02ce25 e4f151e8f7061ce23fee2292d497691465d2947e c553d8c5bcca317cb26d17427fa3bac3cd9c7592

Workflow run logs.

@freef4ll
Copy link

Please note that Brew can't install 22.3.6: #7757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

brew/mac: Install the M1 rpk version on M1 macs
6 participants