restic / rest-server

Rest Server is a high performance HTTP server that implements restic's REST backend API.
BSD 2-Clause "Simplified" License
922 stars 138 forks source link

Building from source reports wrong version number #226

Closed meise closed 1 year ago

meise commented 1 year ago

Output of rest-server --version

$ git log
commit 834a3378e91b461619147cdb8ea8604c000d841a (grafted, HEAD, tag: v0.12.0)
Author: Leo R. Lundgren <leo@finalresort.org>
Date:   Mon Apr 24 13:15:03 2023 +0200

    doc: Polish changelogs

$ docker build .
[+] Building 12.6s (10/15) 
…
 => => writing image sha256:0649c3b2889bb0870722f39a339614714f7c67868b74916f89f445cb0fa436fb                                                             0.0s

$ docker run sha256:0649c3b2889bb0870722f39a339614714f7c67868b74916f89f445cb0fa436fb /usr/bin/rest-server --version
rest-server version rest-server 0.11.0 compiled with go1.20.3 on linux/amd64

How did you run rest-server exactly?

rest-server --version

What backend/server/service did you use to store the repository?

no special backend

Expected behavior

Building tag v0.12.0 should result in rest-server --version output rest-server version rest-server 0.12.0 compiled with foo on bar.

Actual behavior

Building tag v0.12.0 results in rest-server --version output rest-server version rest-server 0.11.0 compiled with foo on bar.

Steps to reproduce the behavior

Build tag v0.12.0 from source.

Do you have any idea what may have caused this?

There is a hard coded version number in cmd/rest-server/main.go which is automatically replaced in the releaser pipeline. In tag v0.12.0 the hard coded version was not increased.

So the automatic releases are ok, but manual builds have the wrong version number.

Do you have an idea how to solve the issue?

Increase version number manually or replace hard coded version numbers in source code with some automatism.

Did rest-server help you today? Did it make you happy in any way?

It's great.

MichaelEischer commented 1 year ago

Fixed by https://github.com/restic/rest-server/commit/efe070c66d8cae962d189dad722aaca30426a8ce

meise commented 1 year ago

Thank you for looking into it.

Even with the added commits, version variable in cmd/rest-server/main.go is still hard coded to 0.11.0 and manual build leads to an incorrect version number with --version.

MichaelEischer commented 1 year ago

Arghh, sorry for the oversight. Should be fixed by https://github.com/restic/rest-server/commit/e8a839673f2962a35f7203850f94a26cfc80aabf