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

Incorrect instructions in DEVELOPING.md to build Grype from source #1796

Closed
colton-freeman opened this issue Apr 10, 2024 · 4 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@colton-freeman
Copy link

colton-freeman commented Apr 10, 2024

What happened:
When trying to build Grype from the source.tar I am running into an error go: build output "grype" already exists and is a directory

What you expected to happen:
After running go build ./cmd/grype Grype is now functional.

How to reproduce it (as minimally and precisely as possible):
trying to build in a Dockerfile. Using golang-1.21.8 as builder. I copy down the source.tar and then run the command suggested in the DEVELOPING.md it downloads the go.mod and then errors out. Trying to git clone produces same error.

Anything else we need to know?:
I have tried in multiple locations with the same error. Removing the grype directory obviously does not work ha.

Environment:

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"

@colton-freeman colton-freeman added the bug Something isn't working label Apr 10, 2024
@kzantow
Copy link
Contributor

kzantow commented Apr 11, 2024

I don't think we will be able to support this exact use case, since as you noted there is a grype directory and this is unlikely to change.

You have a couple options:

  • Use go run ./cmd/grype, which is effectively what many of us do during development. You can make code changes and re-run this easily.
  • Run make snapshot (after make bootstrap), which will build snapshot releases closest to what our release process does, but this is considerably slower as it builds binaries for all supported platforms.

It looks like we need to get the DEVELOPING.md updated.

@kzantow kzantow changed the title Building Grype from source errors out. Incorrect instructions in DEVELOPING.md to build Grype from source Apr 11, 2024
@colton-freeman
Copy link
Author

Ah, well thats a bummer. Neither of those use cases will work for us but thank you for the quick feedback. The install.sh build does work for us but was hoping for a source route. If need be you can feel free to close this issue.

@kzantow
Copy link
Contributor

kzantow commented Apr 11, 2024

@colton-freeman you can also just build the binary with -o <binary-file-name>, for example:

go build -o build/grype ./cmd/grype

... will give you a binary named grype output in a build directory

@colton-freeman
Copy link
Author

oh very nice. that might work for us, thank you.

@willmurphyscode willmurphyscode added documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 11, 2024
@spiffcs spiffcs closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Archived in project
Development

No branches or pull requests

4 participants