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

loki 2.7 wrong version information #7669

Closed
michaelkebe opened this issue Nov 11, 2022 · 9 comments · Fixed by #8232
Closed

loki 2.7 wrong version information #7669

michaelkebe opened this issue Nov 11, 2022 · 9 comments · Fixed by #8232
Labels
2.7 type/bug Somehing is not working as expected

Comments

@michaelkebe
Copy link

Describe the bug

$ loki -version
loki, version HEAD-1b627d8 (branch: HEAD, revision: 1b627d880)
  build user:       root@079d888186e6
  build date:       2022-11-10T23:52:44Z
  go version:       go1.19.2
  platform:         linux/amd64

Additionally the metric loki_build_info contains
loki_build_info{branch="HEAD", goversion="go1.19.2", instance="loki-test.hkm.de:3100", job="loki", revision="1b627d880", version="HEAD-1b627d8"}

Maybe promtail is affected, too. I haven't checked it.

To Reproduce
See above

Expected behavior
loki -version should report version 2.7 instead of git hash.

@michaelkebe michaelkebe changed the title loki 2.7 report not the correct version loki 2.7 reports git hash instead of version Nov 11, 2022
@michaelkebe michaelkebe changed the title loki 2.7 reports git hash instead of version loki 2.7 wrong version information Nov 11, 2022
@michaelkebe
Copy link
Author

Maybe promtail is affected, too. I haven't checked it.

Yes, it is affected, too.

$ ./promtail-linux-amd64 -version
promtail, version HEAD-1b627d8 (branch: HEAD, revision: 1b627d880)
  build user:       root@079d888186e6
  build date:       2022-11-10T23:52:44Z
  go version:       go1.19.2
  platform:         linux/amd64

@kavirajk
Copy link
Contributor

Just checking. this is what it tells me for v2.6.0. So yea this needs a fix.

loki, version 2.6.0 (branch: HEAD, revision: b92f113cb)
  build user:       root@6af236db210a
  build date:       2022-07-08T13:40:05Z
  go version:       go1.17.6
  platform:         linux/amd64

@frittentheke
Copy link
Contributor

This happend in the past (#4587), so maybe there is some CI magic missing for the release step?

@patrickjahns
Copy link

I also just noticed this when updating my Ansible role for promtail. One task of the ci run is to confirm that actually the correct version gets installed.

It's quite annoying that it's the second time this is happening. In my opinion, embedding version information during a release is important and should not be neglected like this. It helps to ensure automation for downstream projects

@michaelkebe
Copy link
Author

I fully agree with @patrickjahns.

Btw we are using your role happily in our environment. Thanks 🌺

@rvalab
Copy link

rvalab commented Nov 21, 2022

LogCLI is affected too:

# logcli --version
logcli, version HEAD-1b627d8 (branch: HEAD, revision: 1b627d880)
  build user:       root@079d888186e6
  build date:       2022-11-10T23:52:44Z
  go version:       go1.19.2
  platform:         linux/amd64

@michaelkebe
Copy link
Author

2.7.1 is still affected

@HwangTaehyun
Copy link
Contributor

When I build locally, it shows exact version number (check out v2.7.1 and make promtail). I also suspect CI process.

@HwangTaehyun
Copy link
Contributor

HwangTaehyun commented Jan 22, 2023

This could happen if a build tag like v2.7.1 was not fetched properly and then the build process was running.

image

If there's no tag on the exact commit to publish, then BRANCH variable becomes HEAD, so the VERSION variable becomes like "HEAD-e0af1cc".

loki/tools/image-tag

Lines 7 to 21 in 86dcc82

WIP=$(git diff --quiet || echo '-WIP')
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#/#-#g')
# When 7 chars are not enough to be unique, git automatically uses more.
# We are forcing to 7 here, as we are doing for grafana/grafana as well.
SHA=$(git rev-parse --short=7 HEAD | head -c7)
# If not a tag, use branch-hash else use tag
TAG=$((git describe --exact-match 2> /dev/null || echo "") | sed 's/v//g')
if [ -z "$TAG" ]
then
echo "${BRANCH}"-"${SHA}""${WIP}"
else
echo "${TAG}"
fi

loki/Makefile

Line 35 in 86dcc82

IMAGE_TAG := $(shell ./tools/image-tag)

grafanabot pushed a commit that referenced this issue Jan 27, 2023
MichelHollands added a commit that referenced this issue Jan 27, 2023
…#7669, #8055) (#8314)

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Co-authored-by: Taehyun Hwang <eeht1717@gmail.com>
Co-authored-by: Michel Hollands <michel.hollands@grafana.com>
@chaudum chaudum added the type/bug Somehing is not working as expected label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7 type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants