quay / clair

Vulnerability Static Analysis for Containers

Home Page:https://quay.github.io/clair/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clairctl release version is “???”

leiqi96 opened this issue · comments

Description of Problem / Feature Request

clairctl version is "???" when running command clairctl -h under a non git directory.
clairctl is downloaded from release page
https://github.com/quay/clair/releases/tag/v4.5.0

./clairctl-linux-amd64 -h
NAME:
clairctl - interact with a clair API

USAGE:
clairctl-linux-amd64 [global options] command [command options] [arguments...]

VERSION:
???

DESCRIPTION:
A command-line tool for clair v4.

Expected Outcome

v4.5.0

Actual Outcome

???

Environment

  • Clair version/image:
  • Clair client name/version:
  • Host OS: Ubuntu
  • Kernel (e.g. uname -a): 5.15.0-52-generic
  • Kubernetes version (use kubectl version):
  • Network/Firewall setup:

I found out it was because of git workflow.
https://github.com/quay/clair/blob/main/.github/workflows/cut-release.yml#L130-L131

workflow can not set the value of cmd.Version.
https://github.com/quay/clair/blob/main/cmd/build.go#L23-L31.

Maybe someone can pass CLAIR_VERSION like that leiqi96@f74073d.

but I do not know how to fix it in workflow.

If changing cut-release.yaml like that
go build -ldflags="-X github.com/quay/clair/v4/cmd.Version=${{ needs.config.outputs.version }}" -o "clairctl-${{matrix.goos}}-${{matrix.goarch}}" ./cmd/clairctl, It maybe can solve this issue.