webappio / sanic

Build lots of Docker images at once, then deploy them with Kubernetes
https://sanic.io
Apache License 2.0
265 stars 17 forks source link

Version output is incorrect #6

Closed dbirks closed 5 years ago

dbirks commented 5 years ago

Hello, I'm building 1.2.6 from the release tarball, and it's reporting that it's at version 1.0.0.

$ sanic -v
sanic version 1.0.0

I believe due to app.Version here: https://github.com/distributed-containers-inc/sanic/blob/master/main.go#L25

Thanks for all your work on this!

ColinChartier commented 5 years ago

Should be resolved: https://github.com/distributed-containers-inc/sanic/commit/5669332222e3ab887c8c5dd3dd054bb4e03abf7d

I'll start bumping version numbers at tag time, but for now the tag 1.2.6 doesn't align with the commit that changes the version number.

dbirks commented 5 years ago

While updating the AUR package today, I noticed tag 1.2.11 had version 1.2.8 :P

I'm not a Go programmer, but I've seen other ways that look convenient, so it's not such a manual process. Kail puts version in a var, then it looks like it can be compiled with a ldflag -X main.version=1.2.11. Oh and with a small Makefile to do your bidding, it makes it easier to grab the tag from git. (With maybe something like git describe --abbrev=0 --tags?)

Anyways, :man_cartwheeling: no worries :man_cartwheeling: if you'd rather not. Just wanted to share what I've seen.

ColinChartier commented 5 years ago

I'm working on setting up CI to deal with versions automatically, hopefully this will be permanently resolved then.

ColinChartier commented 5 years ago

Thanks for the comprehensive comment, I've updated the build process to use that exact approach.

In your AUR package, add --ldflags "-X main.version=$(git describe --abbrev=0 --tags)" to the build line.

dbirks commented 5 years ago

Very cool :+1: Just updated the AUR package too.