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

Setup goreleaser for gwctl to generate binaries for various platforms #3038

Closed

Conversation

gauravkghildiyal
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:

  • Introduce gwctl version command to print binary information.
    ❯ gwctl version
    Version: 1.0.0-SNAPSHOT-ca344b9a
    Git Commit: ca344b9aa43ad5acc81235b25097fd20d8e97068
    Build Date: 2024-05-01T06:29:53Z
    
  • Setup goreleaser to build binaries for various platforms

NOTES for the reviewer:

  • LICENSE file is added to the gwctl subdirectory so that it get's included in the archives generated by goreleaser.
  • Actual steps of how maintainers will make use of goreleaser to generate the binaries will be added independently (likely after some discussion)

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. 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. labels May 1, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauravkghildiyal

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. area/gwctl size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 1, 2024
Comment on lines +11 to +12
- go mod tidy
- go build -o ./dist/gwctl ./main.go
Copy link
Contributor

Choose a reason for hiding this comment

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

At some point, both this and the repo CI should probably include a test suite. Much larger change, non-blocking for this one, but something to put on your todo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely yes.

@youngnick
Copy link
Contributor

/lgtm
/hold for further review though

@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 May 6, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2024
@gauravkghildiyal
Copy link
Member Author

/retest

# For local testing, use:
#
# goreleaser release --snapshot --clean
project_name: gwctl
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we intend to keep gwctl as a standalone binary or as a kubectl plugin? If it is both, then wouldn't it be better to name the binary kubectl-*?

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR only intended to make this available as a standalone binary, but you are right for kubectl plugin that is indeed a better name. (I'll attempt at addressing this in the new PR)

Comment on lines +100 to +110
func newVersionCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the version information of gwctl",
Long: `Print the version information of gwctl, including version, git commit and build date.`,
Run: func(*cobra.Command, []string) {
fmt.Println(version.GetVersionInfo())
},
}
return cmd
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Shouldn't this be moved to a separate file like the rest of the subcommands?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure can! Thanks

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 17, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

@shaneutt shaneutt added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 21, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 21, 2024
@mlavacca
Copy link
Member

I'll take a look into it

/cc

- -s -w
# Embed versioning and build information in the binary.
- -X sigs.k8s.io/gateway-api/gwctl/pkg/version.version={{.Version}}
- -X sigs.k8s.io/gateway-api/gwctl/pkg/version.gitCommit={{.Commit}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think .Commit is deprecated. Should we use .FullCommit perhaps instead?

Suggested change
- -X sigs.k8s.io/gateway-api/gwctl/pkg/version.gitCommit={{.Commit}}
- -X sigs.k8s.io/gateway-api/gwctl/pkg/version.gitCommit={{.FullCommit}}

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah thanks! Didn't know about the deprecation. Will update.

@k8s-ci-robot
Copy link
Contributor

@gauravkghildiyal: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gateway-api-crds-validation-1 997fc07 link true /test pull-gateway-api-crds-validation-1
pull-gateway-api-crds-validation-2 997fc07 link true /test pull-gateway-api-crds-validation-2
pull-gateway-api-crds-validation-4 997fc07 link true /test pull-gateway-api-crds-validation-4
pull-gateway-api-crds-validation-3 997fc07 link true /test pull-gateway-api-crds-validation-3
pull-gateway-api-crds-validation-5 997fc07 link true /test pull-gateway-api-crds-validation-5

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

@gauravkghildiyal
Copy link
Member Author

Thanks for the reviews here everyone! Closing this in favor of resolving this within https://github.com/kubernetes-sigs/gwctl.

/close

@k8s-ci-robot
Copy link
Contributor

@gauravkghildiyal: Closed this PR.

In response to this:

Thanks for the reviews here everyone! Closing this in favor of resolving this within https://github.com/kubernetes-sigs/gwctl.

/close

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-sigs/prow repository.

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. area/gwctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants