weaveworks / scope

Monitoring, visualisation & management for Docker & Kubernetes
https://www.weave.works/oss/scope/
Apache License 2.0
5.84k stars 708 forks source link

make command is failing with printer dependency #3832

Closed srajmane closed 3 years ago

srajmane commented 3 years ago

What you expected to happen?

To pass make command

What happened?

While building weaveworks/scope-backend-build docker image make command is giving below issue on master and v1.13.1 :

/src/github.com/weaveworks/scope$ make
sudo -E docker build -t weaveworks/scope-backend-build backend
Sending build context to Docker daemon  6.144kB
Step 1/12 : FROM golang:1.13.9
...
...
Step 4/12 : RUN go clean -i net &&      go install -tags netgo std &&
..
package github.com/hashicorp/hcl/hcl/printer: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
        /usr/local/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
        /go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)

How to reproduce it?

To reproduce this error just clone scope and run make command

git clone https://github.com/weaveworks/scope.git $GOPATH/src/github.com/weaveworks/scope
cd $GOPATH/src/github.com/weaveworks/scope
make

Versions:

$ scope version : v1.13.1 and master
$ docker version: 19.03.6
$ uname -a : Linux  4.15.0-135-generic #139-Ubuntu x86_64 x86_64 x86_64 GNU/Linux
$ kubectl version
bboreham commented 3 years ago

..

You appear to have elided the part that would show what it was doing at the time it failed.

However it looks like the upstream dependency made a breaking change. Probably something else needs to be updated to match (or removed; there is some old cruft in there)

srajmane commented 3 years ago

@bboreham To avoid too many lines in the log I have added .... Please check the below-mentioned log.

~/src/github.com/weaveworks/scope$ make
sudo -E docker build -t weaveworks/scope-backend-build backend
Sending build context to Docker daemon  6.144kB
Step 1/12 : FROM golang:1.14.2
 ---> 2421885b04da
Step 2/12 : ENV SCOPE_SKIP_UI_ASSETS true
 ---> Using cache
 ---> e2b73c3a8738
Step 3/12 : RUN set -eux;    export arch_val="$(dpkg --print-architecture)";    apt-get update &&    if [ "$arch_val" = "amd64" ]; then      apt-get install -y libpcap-dev time file shellcheck git gcc-arm-linux-gnueabihf curl build-essential python-pip;    else      apt-get install -y libpcap-dev time file shellcheck git curl build-essential python-pip;    fi;       rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> d87751044934
Step 4/12 : RUN go clean -i net &&      go install -tags netgo std &&    export arch_val="$(dpkg --print-architecture)";    if [ "$arch_val" != "ppc64el" ]; then      go install -race -tags netgo std;    fi;     go get -tags netgo                github.com/fzipp/gocyclo                golang.org/x/lint/golint               github.com/kisielk/errcheck             github.com/fatih/hclfmt                 github.com/mjibson/esc                 github.com/client9/misspell/cmd/misspell &&     chmod a+wr --recursive /usr/local/go &&        rm -rf /go/pkg/ /go/src/
 ---> Running in fef1bdbf9a88
package github.com/hashicorp/hcl/hcl/printer: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
        /usr/local/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
        /go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)
The command '/bin/sh -c go clean -i net &&      go install -tags netgo std &&    export arch_val="$(dpkg --print-architecture)";    if [ "$arch_val" != "ppc64el" ]; then      go install -race -tags netgo std;    fi;     go get -tags netgo                github.com/fzipp/gocyclo                golang.org/x/lint/golint               github.com/kisielk/errcheck             github.com/fatih/hclfmt               github.com/mjibson/esc           github.com/client9/misspell/cmd/misspell &&     chmod a+wr --recursive /usr/local/go &&        rm -rf /go/pkg/ /go/src/' returned a non-zero code: 1
Makefile:239: recipe for target '.scope_backend_build.uptodate' failed
make: *** [.scope_backend_build.uptodate] Error 1
bboreham commented 3 years ago

Given the missing dependency has 'hcl' in the name and that line is building 'hclfmt', that is where I would start.

There is no reason for Scope to need hclfmt as part of its build.

BTW I pushed #3833 which I was working on a few weeks back; hadn't changed this line.

srajmane commented 3 years ago

https://github.com/fatih/hclfmt This repository has been archived by the owner. I will try to build by removing hclfmt module.

srajmane commented 3 years ago

@bboreham I tried to run the make command by removing - github.com/fatih/hclfmt \, able to build backdend/Dockerfile. But make and make tests command is failing with permission.

make command log. sudo make command is passing.

~/src/github.com/weaveworks/scope$ make

mkdir -p .cache/build_node_modules client/node_modules
if test "true" != ""; then \
        sudo -E docker run --rm -ti \
                -v /home/snehal/src/github.com/weaveworks/scope/.cache:/home/weave/scope/.cache \
                -v /home/snehal/src/github.com/weaveworks/scope/client:/home/weave/scope/client \
                -v /home/snehal/src/github.com/weaveworks/scope/.cache/build_node_modules:/home/weave/scope/client/node_modules \
                -w /home/weave/scope/client \
                -u 1002:1002 \
                weaveworks/scope-ui-build yarn install; \
fi

yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.87s.
Error: EACCES: permission denied, open '/.yarnrc'
Makefile:140: recipe for target '.cache/build_node_modules/.uptodate' failed

make tests command log. After running sudo -E make tests, the command is still failing with the below error.

~/src/github.com/weaveworks/scope$ make tests
sudo -E docker run --rm -ti \
        -v /home/snehal/src/github.com/weaveworks/scope:/go/src/github.com/weaveworks/scope \
        -v /home/snehal/src/github.com/weaveworks/scope/.pkg:/go/pkg \
        --net=host \
        -e GOARCH -e GOOS -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL \
        -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW -e TESTDIRS \
        weaveworks/scope-backend-build SCOPE_VERSION=2f9ccdc8 CODECGEN_UID=0 tests
make: Entering directory '/go/src/github.com/weaveworks/scope'
mkdir -p client/build
if test "true" != "true"; then cd client && yarn run build; fi
./tools/test -no-go-get -tags 'netgo unsafe'
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
go: writing go.mod cache: mkdir /go/pkg/mod: permission denied
srajmane commented 3 years ago

@bboreham Could you please have a look?

bboreham commented 3 years ago

Solved by #3834