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

make bootstrap fails on clean pull of main #1773

Closed
popey opened this issue Mar 26, 2024 · 5 comments · Fixed by #1842
Closed

make bootstrap fails on clean pull of main #1773

popey opened this issue Mar 26, 2024 · 5 comments · Fixed by #1842
Assignees
Labels
bug Something isn't working changelog-ignore Don't include this issue in the release changelog

Comments

@popey
Copy link

popey commented Mar 26, 2024

👋

What happened:

I followed instructions to build grype from a clone of this repo, but I didn't succeed. Am I holding it wrong? 🤔

alan@asimo:~/Source/anchore$ git clone https://github.com/anchore/grype
Cloning into 'grype'...
remote: Enumerating objects: 10988, done.
remote: Counting objects: 100% (2157/2157), done.
remote: Compressing objects: 100% (430/430), done.
remote: Total 10988 (delta 1881), reused 1854 (delta 1723), pack-reused 8831
Receiving objects: 100% (10988/10988), 4.39 MiB | 5.09 MiB/s, done.
Resolving deltas: 100% (7401/7401), done.
alan@asimo:~/Source/anchore$ cd grype/
alan@asimo:~/Source/anchore/grype$ go build ./cmd/grype
go: build output "grype" already exists and is a directory
1 alan@asimo:~/Source/anchore/grype$ make bootstrap
mkdir -p ./.tmp
go mod download
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b ./.tmp/ v0.4.1
[info] using release tag='v0.4.1' version='0.4.1' os='linux' arch='arm64' 
[info] installed ./.tmp//quill 
GO111MODULE=off GOBIN=/home/alan/Source/anchore/grype/.tmp go get -u golang.org/x/perf/cmd/benchstat
go: modules disabled by GO111MODULE=off; see 'go help modules'
make: *** [Makefile:112: bootstrap-tools] Error 1

What you expected to happen:

As I understand it, make bootstrap should pull the necessary tools to run tests and build all artefacts.

How to reproduce it (as minimally and precisely as possible):

Running Ubuntu 23.10 on arm64 with go1.22.1 I tried the build from source instructions in https://github.com/anchore/grype/blob/main/DEVELOPING.md

Anything else we need to know?:

Environment:

  • Output of grype version: Building from source
  • OS (e.g: cat /etc/os-release or similar):
alan@asimo:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 23.10"
NAME="Ubuntu"
VERSION_ID="23.10"
VERSION="23.10 (Mantic Minotaur)"
VERSION_CODENAME=mantic
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=mantic
LOGO=ubuntu-logo

@popey popey added the bug Something isn't working label Mar 26, 2024
@tgerla
Copy link
Contributor

tgerla commented Mar 28, 2024

Possibly related: #1739 -- it looks like this problem occurs with Go 1.22 but not Go 1.21.

@tgerla
Copy link
Contributor

tgerla commented Mar 28, 2024

Dev note: we need to move Grype to Binny (https://pkg.go.dev/github.com/anchore/binny -- already used by Syft) to make the bootstrap process more reliable.

@pouyan021
Copy link

Just executed make bootstrap today with go version 1.22.1 darwin/amd64. No such problem occurred.

@spiffcs
Copy link
Contributor

spiffcs commented Apr 17, 2024

For those coming to this issue - we're updating the Developing.md and adding some new smoothing/bootstrapping for new users. For now please try the following for the build command:

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

To run from source:

go run ./cmd/grype/main.go

@popey
Copy link
Author

popey commented Apr 17, 2024

While possibly a separate bug (let me know if I should file as such), I thought I'd mention here the following as you said that the Developing.md is being smoothed, and this was me running through that documentation.

This line in the Makefile:

SNAPSHOT_BIN := $(realpath $(shell pwd)/$(SNAPSHOT_DIR)/$(OS)-build_$(OS)_amd64_v1/$(BIN))

Has an architecture hardwired into it, which is probably why, later in the make all, this happens on my arm64 macbook pro:

  • docker images
    • building docker image                          image=anchore/grype:debug-ppc64le
    • building docker image                          image=anchore/grype:v0.76.0-arm64v8
    • building docker image                          image=anchore/grype:v0.76.0-ppc64le
    • building docker image                          image=anchore/grype:debug-s390x
    • building docker image                          image=anchore/grype:debug-arm64v8
    • building docker image                          image=anchore/grype:debug
    • building docker image                          image=anchore/grype:latest
    • building docker image                          image=anchore/grype:v0.76.0-s390x
    • took: 8s
  • storing artifacts metadata
    • writing                                        file=snapshot/artifacts.json
  • you are using deprecated options, check the output above for details
  • release succeeded after 42s
  • thanks for using goreleaser!
chmod 755 ""
chmod: : No such file or directory
make: *** [cli] Error 1

Those chmod lines appear originate in the Makefile, as this is the only occurrance of chmod in the file.

.PHONY: cli
cli: $(SNAPSHOT_DIR)  ## Run CLI tests
        chmod 755 "$(SNAPSHOT_BIN)"
        $(SNAPSHOT_BIN) version
        SYFT_BINARY_LOCATION='$(SNAPSHOT_BIN)' \
                go test -count=1 -timeout=15m -v ./test/cli

@wagoodman wagoodman self-assigned this May 2, 2024
@wagoodman wagoodman added the changelog-ignore Don't include this issue in the release changelog label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working changelog-ignore Don't include this issue in the release changelog
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants