resonate icon indicating copy to clipboard operation
resonate copied to clipboard

Add version command

Open dfarr opened this issue 10 months ago • 3 comments

It would be nice to see the version of resonate I have installed locally.

resonate --version

The version is tied to the git tag and can be set via build flags in our release pipeline, we should assert that the git tag matches the version in our release pipeline.

  • [ ] set tag in release pipeline
  • [ ] assert git tag matches resonate --version

dfarr avatar Apr 24 '24 18:04 dfarr

Version can be derived from the Git Tag, but not necessarily required for the mvp.

flossypurse avatar Sep 10 '24 16:09 flossypurse

kindly assign this to me

rishirishhh avatar Sep 29 '24 14:09 rishirishhh

@rishirishhh - don't hesitate to reach out for any clarification or to chat about requirements and/or design!

flossypurse avatar Sep 29 '24 14:09 flossypurse

@rishirishhh - are you still interested in working on this? If so, I highly recommend joining the Discord: https://resonatehq.io/discord and jump into the resonate-engineering channel to get any help you might need.

flossypurse avatar Dec 17 '24 15:12 flossypurse

Hi, Can I work on this PR?

I already see this opened PR: https://github.com/resonatehq/resonate/pull/342

Is this still going? Can I take inspiration from this code or this solution is not valid?

fuadnafiz98 avatar Dec 19 '24 06:12 fuadnafiz98

Just closed that PR for being stale.

I think we can take inspiration from the ldflags, but simplify things a little bit. Here's what I'm thinking.

Add the following to the root command:

var (
	cfgFile string
	version string = "unknown"
)

var rootCmd = &cobra.Command{
	Use:     "resonate",
	Short:   "Resonate: distributed async await",
	Version: version,
}

Then we can build resonate with an ldflag like this:

go build -ldflags "-X github.com/resonatehq/resonate/cmd.version=SET_VIA_LDFLAGS" -o resonate
./resonate --version

Most of the work will involve updating the build scripts to set the version accordingly. What do you think about the following strategy?

  1. Use git tag if available (eg: "v1.0.0")
  2. Otherwise use commit (eg: "cc66e5135531111757c3e28f0a6fc053bc7c8fa8")
  3. Otherwise, fall back to "unknown"

dfarr avatar Dec 19 '24 21:12 dfarr

Hi, I think it makes sense.

I will look into this

fuadnafiz98 avatar Dec 20 '24 17:12 fuadnafiz98