Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Add versions - kubeops#3441

Merged
antgamdia merged 3 commits into
vmware-tanzu:masterfrom
antgamdia:addVersions-kubeops
Sep 21, 2021
Merged

Add versions - kubeops#3441
antgamdia merged 3 commits into
vmware-tanzu:masterfrom
antgamdia:addVersions-kubeops

Conversation

@antgamdia
Copy link
Copy Markdown
Contributor

@antgamdia antgamdia commented Sep 17, 2021

Description of the change

This PR adds the --version command to kubeops

Besides, it also adapts the code to the latest cobra boilerplate, so that all of our binaries are similar.

Benefits

Our binaries will properly display their version

Possible drawbacks

N/A

Applicable issues

Additional information

Testing with:

DOCKER_BUILDKIT=1 docker build -t kubeapps/kubeops:dev --build-arg "VERSION=$(git rev-parse HEAD)" -f cmd/kubeops/Dockerfile .

docker run  docker.io/kubeapps/kubeops:dev ./kubeops --version

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Comment thread cmd/kubeops/Dockerfile
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X main.version=$VERSION" ./cmd/kubeops
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X github.com/kubeapps/kubeapps/cmd/kubeops/cmd.version=$VERSION" ./cmd/kubeops
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it from: go tool nm ./kubeops | grep cmd.version

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
@antgamdia antgamdia merged commit ed9210f into vmware-tanzu:master Sep 21, 2021
@antgamdia antgamdia deleted the addVersions-kubeops branch September 21, 2021 09:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants