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

Unable to run make hack-build-cli #1789

Closed
4 tasks done
webstradev opened this issue Apr 7, 2024 · 17 comments · Fixed by #1835
Closed
4 tasks done

Unable to run make hack-build-cli #1789

webstradev opened this issue Apr 7, 2024 · 17 comments · Fixed by #1835

Comments

@webstradev
Copy link
Contributor

webstradev commented Apr 7, 2024

Checklist

  • I've searched the issue queue to verify this is not a duplicate bug report.
  • I've included steps to reproduce the bug.
  • I've pasted the output of kargo version.
  • I've pasted logs, if applicable.

Description

This isn't a bug in Kargo just in the Makefile so only relevant for developers/contributors

When running make hack-build-cli I encounter the following error:

docker run -it --rm -v gomodcache:/home/user/gocache -v /Users/webstradev/development/personal/kargo/:/workspaces/kargo -v /workspaces/kargo/ui/node_modules -w /workspaces/kargo kargo:dev-tools sh -c 'GOOS=darwin GOARCH=arm64 make build-cli' CGO_ENABLED=0 go build \ -ldflags "-w -X github.com/akuity/kargo/internal/version.version= -X github.com/akuity/kargo/internal/version.buildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -X github.com/akuity/kargo/internal/version.gitCommit= -X github.com/akuity/kargo/internal/version.gitTreeState=" \ -o bin/kargo-darwin-arm64 \ ./cmd/cli error obtaining VCS status: exit status 128 Use -buildvcs=false to disable VCS stamping. make: *** [Makefile:109: build-cli] Error 1 make: *** [hack-build-cli] Error 2 webstradev@Eriks-MacBook-Pro kargo %

When I add -buildvcs - false, as the error message suggests it works just fine.

Running make build-cli (without the hack) also works as intended.

Screenshots

Steps to Reproduce

switch to main branch, run make hack-build-cli

Version

Paste the output from `kargo version` here.

not applicable as I can't successfully build the CLI

Logs

Paste any relevant application logs here.

See description.

@webstradev
Copy link
Contributor Author

Just to add to this I have just run into a similar issue when running make hack-lint-go:

image

@webstradev
Copy link
Contributor Author

I have a feeling it came from thsi changes because I remember that in mid February I didn't have such issues yet:
#1517

@krancour
Copy link
Member

krancour commented Apr 7, 2024

@webstradev can you try deleting the Docker volume named gomodcache?

I believe anyone who contributed prior to #1517 might be encountering this and that is a one-time fix that seems to work.

@webstradev
Copy link
Contributor Author

So I had already done this as Christian pointed it out in discord. I was experiencing another issue also cause bij #1517.
I have again deleted the docker volume but still encountering this issue.

@krancour
Copy link
Member

krancour commented Apr 7, 2024

Hmm. Ok will look at this close during the week.

@webstradev
Copy link
Contributor Author

Happy to help you debug it on my machine if that makes things easier @krancour

@hiddeco
Copy link
Contributor

hiddeco commented Apr 8, 2024

Can you share some more information about your macOS and Docker setup? As both Kent and I are on macOS where it works fine, I think we have to figure out what's different for your machine.

@webstradev
Copy link
Contributor Author

webstradev commented Apr 8, 2024

I'm on a m2 Macbook Pro with Ventura 13.5.2
Docker: Current version: 4.27.1 (136059) (Docker Desktop)
Go: go version go1.22.2 darwin/arm64
git version: 2.35.2

Also something that I noticed, hack-build-cli fails, hack-lint-go fails with the same error but hack-unit-test passess just fine.

@webstradev
Copy link
Contributor Author

webstradev commented Apr 8, 2024

Some additional logging from adding -v to the build command

State="
-o bin/kargo-darwin-arm64
-v
./cmd/cli

cd /workspaces/kargo; git status --porcelain

fatal: detected dubious ownership in repository at '/workspaces/kargo'
To add an exception for this directory, call:

    git config --global --add safe.directory /workspaces/kargo

error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.

some further digging shows this;
This error is returned when the user that owns the local repository is different than the user executing the git command. To avoid this, it's strongly recommended for each user have their own clone of the repository.

@krancour
Copy link
Member

krancour commented Apr 8, 2024

fwiw... we have always had to set -buildvcs=false when we build the CLI in our CI and release processes as well.

@webstradev
Copy link
Contributor Author

webstradev commented Apr 8, 2024

Is that because you set version related information via ldflags anyways and you don't need the vcs metadata?

FYI I have just checked out the commit before #1517 and make hack-build-cli does work properly there so it is likely to be something that changed in that PR

@krancour
Copy link
Member

krancour commented Apr 8, 2024

Is that because you set version related information via ldflags anyways and you don't need the vcs metadata?

It's not strictly because of it, but at some point when first developing those automations, we must have encountered this same issue and decided that we could forgo the VCS metadata without worry due to what we were doing with the ldflags already.

My search history shows I first looked up this issue 8 months ago!

@krancour
Copy link
Member

krancour commented Apr 8, 2024

FYI I have just checked out the commit before #1517 and make hack-build-cli does work properly there so it is likely to be something that changed in that PR

I agree this seems likely.

@hiddeco
Copy link
Contributor

hiddeco commented Apr 8, 2024

Can you try erasing the node modules directory and then rerunning the command?

@webstradev
Copy link
Contributor Author

Can you try erasing the node modules directory and then rerunning the command?

I have nothing in there as I just recloned the whole repo.

@webstradev
Copy link
Contributor Author

Anything else you would like me to try here, or alternatively i can make a pr to add -buildvcs=false to the goflags

@krancour
Copy link
Member

or alternatively i can make a pr to add -buildvcs=false to the goflags

We're already passing all necessary version info in through other means, so I think I would find this acceptable.

Thank you!

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

Successfully merging a pull request may close this issue.

3 participants