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

Broken version output when packaging frizbee for openSUSE #143

Closed
johanneskastl opened this issue Jun 10, 2024 · 6 comments
Closed

Broken version output when packaging frizbee for openSUSE #143

johanneskastl opened this issue Jun 10, 2024 · 6 comments
Assignees

Comments

@johanneskastl
Copy link

I am packaging frizbee for openSUSE as I find it a highly useful tool.

One thing I cannot get working is the version output. According to the .goreleaser.yaml file and the related issues I found (#57, #58) the following line should do the trick:

go build \
   -mod=vendor \
   -buildmode=pie \
   -trimpath \
   -tags=netgo \
   -ldflags=" \
   -X main.Version=%{version} \
   -X main.Commit=${COMMIT_HASH} \
   -X main.CommitDate=${BUILD_DATE} \
   -X main.TreeState=clean \
   -X github.com/stacklok/frizbee/pkg/constants.CLIVersion=%{version}" \
   -o bin/%{name} main.go

(%{version} is the RPM variable for the version, BUILD_DATE and COMMIT_HASH are the variables set before this command that contain the date and commit hash)

But I always end up with this:

$ frizbee version
Version: dev
Go Version: go1.22.4
Git Commit: 
Commit Date: 
OS/Arch: linux/amd64
Dirty: false

Any idea what could go wrong there? Can I disable the "guess from VCS" buildinfo that go seems to have nowadays (if this causes the issue)?

Thanks in advance!

Kind Regards,
Johannes

@JAORMX
Copy link
Contributor

JAORMX commented Jun 10, 2024

Uhm... this is weird, -X github.com/stacklok/frizbee/pkg/constants.CLIVersion=%{version}" should do the trick. It sets the following variable https://github.com/stacklok/frizbee/blob/main/internal/cli/cli.go#L76 is that being run from a checked out repo? I also don't see the Git Commit info there, which suggests the build is not happening from the repo itself.

@JAORMX
Copy link
Contributor

JAORMX commented Jun 10, 2024

ah! found the issue, the package changed. Fixing.

JAORMX added a commit that referenced this issue Jun 10, 2024
The package had changed and we forgot to change it.

Related-To: #143

Signed-off-by: Juan Antonio Osorio <[email protected]>
@rdimitrov rdimitrov self-assigned this Jun 10, 2024
@rdimitrov
Copy link
Member

@johanneskastl - hey, this should be fixed now 👍 Can you give it another go?

Thanks again for flagging this 🙏

@johanneskastl
Copy link
Author

Thanks for the quick replies! I can confirm that using github.com/stacklok/frizbee/internal/cli.CLIVersion I can successfully set the version.

However GitCommit and Commit Date stay empty. Even though the variables get set properly during the build.

Did something change there, too? Do they also need the "long" package prefix instead of just main?

@JAORMX
Copy link
Contributor

JAORMX commented Jun 11, 2024

@johanneskastl we're not quite sure about what the issue is yet. @rdimitrov opened #148 in the meantime. We'll look into it. Thanks for your patience!

@johanneskastl
Copy link
Author

Then let's close this and follow up in #148 that is specific for commit and date, which is unrelated to openSUSE packaging.

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

No branches or pull requests

3 participants