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

Fix kubectl-retina version #1023

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Fix kubectl-retina version #1023

wants to merge 1 commit into from

Conversation

root-hbx
Copy link

Description

Since v0.0.17, kubectl-retina version will only show a empty line, demonstrated in #1013

Related Issue

#1013

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

None

Additional Notes

None


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@root-hbx root-hbx requested a review from a team as a code owner November 18, 2024 21:13
@root-hbx
Copy link
Author

@root-hbx please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@root-hbx
Copy link
Author

I think the issue lies with the passing of the VERSION parameter, but I’m not sure how to debug and verify it locally (specifically, to check the output of kubectl-retina version after making modifications). Could you give me some hints on how to proceed?

Currently, my approach involves using logging to verify if VERSION is being passed correctly and using a patch to provide a default value for VERSION with the hope to identify any issues by reviewing the logs from CI testing.

If possible, could you enable CI testing for this? @nddq

Copy link
Contributor

@ritwikranjan ritwikranjan left a comment

Choose a reason for hiding this comment

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

Can we get rid of the changes to go.mod and go.sum, doesn't seem relevant to this PR.

cli/Dockerfile Outdated
@@ -15,6 +15,9 @@ ENV GOOS=${GOOS}
ARG GOARCH=amd64
ENV GOARCH=${GOARCH}

# Debugging: Print the values of VERSION and APP_INSIGHTS_ID
RUN echo "VERSION=${VERSION}" && echo "APP_INSIGHTS_ID=${APP_INSIGHTS_ID}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove the debug lines before merging?

Copy link
Member

Choose a reason for hiding this comment

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

+1 . We should remove the debug lines.

@@ -11,11 +11,20 @@ import (
"github.com/microsoft/retina/internal/buildinfo"
)

// This variable is used by the "version" command and is set during build.
// Default to a safe value if not set.
var defaultVersion = "v0.0.5"
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be a misleading info? I don't think it makes sense to have a "default" version

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'd almost rather an empty string here and a loud notification that this wasn't set by some pipeline.

cli/Dockerfile Outdated
@@ -15,6 +15,9 @@ ENV GOOS=${GOOS}
ARG GOARCH=amd64
ENV GOARCH=${GOARCH}

# Debugging: Print the values of VERSION and APP_INSIGHTS_ID
RUN echo "VERSION=${VERSION}" && echo "APP_INSIGHTS_ID=${APP_INSIGHTS_ID}"
Copy link
Member

Choose a reason for hiding this comment

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

+1 . We should remove the debug lines.

Comment on lines 25 to 26
fmt.Println("buildinfo.Version is not set successfully, showing default version:")
fmt.Println(defaultVersion)
Copy link
Member

Choose a reason for hiding this comment

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

I think you can probably get a more useful "default" value out of https://pkg.go.dev/runtime/debug#BuildInfo . There's a property in there for the vcs.revision which should be the commit the binary was built with. It won't be the tag, but the commit is plenty useful (and would be handy for development builds).

@@ -11,11 +11,20 @@ import (
"github.com/microsoft/retina/internal/buildinfo"
)

// This variable is used by the "version" command and is set during build.
// Default to a safe value if not set.
var defaultVersion = "v0.0.5"
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'd almost rather an empty string here and a loud notification that this wasn't set by some pipeline.

go.mod Outdated
@@ -22,7 +22,7 @@ retract (

require (
cel.dev/expr v0.15.0 // indirect
code.cloudfoundry.org/clock v1.0.0 // indirect
code.cloudfoundry.org/clock v1.21.0 // indirect
Copy link
Member

Choose a reason for hiding this comment

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

I'd drop the go.mod and go.sum changes from this. We're not changing any dependencies here, and the upgrades should be handled by dependabot. That'll make the PR simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants