stackrox / kube-linter

KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
https://docs.kubelinter.io/
Apache License 2.0
2.97k stars 234 forks source link

[BUG] `kube-linter version` for v0.6.3 returns the wrong version string #548

Open bitschubse opened 1 year ago

bitschubse commented 1 year ago

System info:

Describe the bug Release 0.6.3 returns v0.6.2-0-g191de10fd5 when calling kube-linter version.

To Reproduce Steps to reproduce the behavior:

wget -q https://github.com/stackrox/kube-linter/releases/download/v0.6.3/kube-linter-linux.tar.gz -O ./kube-linter-lin
ux.tar.gz && tar -xvzf ./kube-linter-linux.tar.gz -C ./
./kube-linter version

Expected behavior kube-linter version returns the correct version.

janisz commented 1 year ago

Good catch. It looks it's a hydra bug :) Trying to fix problem with goproxy caching I pushed new tag to already tagged commit (Currently 0.6.2 and 0.6.3 are on the same tag). Unfortunately in such configuration our automation does not correctly resolve version and as a result we have wrong (untagged version). This will be fixed when we push new commit and create new release.

ifalex commented 1 year ago

Looking at your docker images: docker run artifactory.vwx.spirent.com/dockerhub/stackrox/kube-linter:main-alpine version v0.6.2-13-gee5e482862 and docker run artifactory.vwx.spirent.com/dockerhub/stackrox/kube-linter:v0.6.3-alpine version v0.6.2-0-g191de10fd5 while, doing a brew install on MacOs: kube-linter version -> v0.6.3 Are the versions from docker images matching the binary version itself?

janisz commented 1 year ago

It looks like the problem started in 0.3.0 release

# docker run stackrox/kube-linter:0.3.0 version
0.3.0-0-gbf3a4dbd96
# docker run stackrox/kube-linter:0.2.6 version
0.2.6

One thing that came to my mind is that we use git describe in our get-tag script and that works only with annotated tags. https://github.com/stackrox/kube-linter/blob/88c8908a98a562bac213bb2240e8c7c5defb1a4d/get-tag#L2

On the other hand 0.3.0 release is annotated tag and still version is not correctly resolved

# git for-each-ref refs/tags
51143ce93e291a4929390b9e32c520b44ead3a0b commit refs/tags/0.0.1
3dd7446e57809ef0ac55169c19a5da0d5302ced6 commit refs/tags/0.0.2
e6966fcb1a5f5ff148ecff0b0ad00a0c821db187 commit refs/tags/0.0.3
5e2425e2e1442d1563bad18051c39917c03fa59e commit refs/tags/0.0.4
26a483c02d5981fc1f6a249abf8b86c77307080c commit refs/tags/0.1.0
522267baab6b5c71f15d27d1d0cad3fcfdaf1c03 commit refs/tags/0.1.1
a6df7881ca012d5ea4d88e2e8a73cbe4c382fc13 commit refs/tags/0.1.2
55597dc998f499fdf3ba7d0e58c501365ea66df2 commit refs/tags/0.1.3
12db88411cafedbe9d6870d57a45c0927d27a760 commit refs/tags/0.1.4
0177d11f9452272c214309cda9ba3aaaa64628e8 commit refs/tags/0.1.5
a64df58c92e9dcab418e2cc9f1e796eae70b97fa commit refs/tags/0.1.6
a8478eef702851802631c3dfbcb1aae4126d1e61 commit refs/tags/0.2.0
c53952b8e3bde2d3edfc677ccc05a89298a414d8 commit refs/tags/0.2.1
2d8dff014dda8cd6a7ea10bf665ec421c9350b5c commit refs/tags/0.2.2
e01d3c43c9bfbd8fb77f02417cb484c1c1b212ea commit refs/tags/0.2.3
c12af3736628d22ea6b84a1876ac4ca01174c57a commit refs/tags/0.2.4
15bff8c50e5609a3c76d2eba4b471448afbcb0b1 commit refs/tags/0.2.5
c5bfb22abad311b04065f321924bbffd4ad1353e tag    refs/tags/0.2.6
3ff608d2ca5876df4cde9c0bbb2f8ae86038f210 tag    refs/tags/0.3.0
c37b7551f629d71e45429a2f3c6d11eb64ad0597 commit refs/tags/0.4.0
5b90391fdf8a631c6b9d9608a94b15737700ac09 commit refs/tags/0.5.0
75bff8264aaf2d7ac09a4ffa53cc65cbe0924873 tag    refs/tags/0.5.1
7de27c2a398042bfa5cf69260a3f9464790a30c1 tag    refs/tags/0.6.0
c37b7551f629d71e45429a2f3c6d11eb64ad0597 commit refs/tags/v0.4.0
c6177366a31c05b755ad9adbedd0c6fb54b509ba commit refs/tags/v0.6.1
191de10fd54d6c3f744b740c29fb7943602d85bc commit refs/tags/v0.6.2
191de10fd54d6c3f744b740c29fb7943602d85bc commit refs/tags/v0.6.3
4f0b1e01fd77b2d37c353a82b7f17568a4458527 commit refs/tags/v0.6.4
➜  kube-linter git:(4f0b1e0) git co v0.6.4
HEAD is now at 4f0b1e0 Bump helm.sh/helm/v3 from 3.11.3 to 3.12.0 (#563)
➜  kube-linter git:(4f0b1e0) ./get-tag    
v0.6.4

I have no idea why locally it's working correctly but on GHA it's not https://github.com/stackrox/kube-linter/actions/runs/5012653944/jobs/8985852150#step:4:16

bitschubse commented 10 months ago

@janisz Seems that the problem no more exists in the releases 0.6.5 and 0.6.6. These two releases show the correct version again for me. Should I close this issue?