Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

captainkube: docker build fails #44

Closed
mathieu-benoit opened this issue Feb 1, 2020 · 6 comments
Closed

captainkube: docker build fails #44

mathieu-benoit opened this issue Feb 1, 2020 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mathieu-benoit
Copy link
Contributor

Currently captainkube docker build fails with this error:
Error: error building at STEP "RUN go get -d -v": error while running runtime: exit status 1.
The last successful build I did was around Jan 20th 2020, looks like one of the dependencies changed?

Here is the complete logs output of the docker build command:

STEP 1: FROM golang:1.13.4 AS builder
Getting image source signatures
Copying blob bd9cab5aeb31 done
Copying blob 9c7d0e5c0bc2 done
Copying blob 16ea0e8c8879 done
Copying blob 2a19d2e6789c done
Copying blob 50024b0106d5 done
Copying blob ff95660c6937 done
Copying blob 0ed236c95063 done
Copying config a2e245db8b done
Writing manifest to image destination
Storing signatures
STEP 2: WORKDIR /build
46923fea714213467af460023401930adf5c0f1d112485dd0df353efdbee46e2
STEP 3: COPY main.go .
5c8b046a564aadc48ac1df8160a286291718795b327e34def49882b703695c99
STEP 4: RUN go get -d -v
get "k8s.io/api/core/v1": found meta tag get.metaImport{Prefix:"k8s.io/api", VCS:"git", RepoRoot:"https://github.com/kubernetes/api"} at //k8s.io/api/core/v1?go-get=1
get "k8s.io/api/core/v1": verifying non-authoritative meta tag
k8s.io/api (download)
github.com/gogo/protobuf (download)
get "k8s.io/apimachinery/pkg/api/resource": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/api/resource?go-get=1
get "k8s.io/apimachinery/pkg/api/resource": verifying non-authoritative meta tag
k8s.io/apimachinery (download)
get "gopkg.in/inf.v0": found meta tag get.metaImport{Prefix:"gopkg.in/inf.v0", VCS:"git", RepoRoot:"https://gopkg.in/inf.v0"} at //gopkg.in/inf.v0?go-get=1
gopkg.in/inf.v0 (download)
get "k8s.io/apimachinery/pkg/apis/meta/v1": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/apis/meta/v1?go-get=1
get "k8s.io/apimachinery/pkg/apis/meta/v1": verifying non-authoritative meta tag
github.com/google/gofuzz (download)
get "k8s.io/apimachinery/pkg/fields": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/fields?go-get=1
get "k8s.io/apimachinery/pkg/fields": verifying non-authoritative meta tag
get "k8s.io/klog": found meta tag get.metaImport{Prefix:"k8s.io/klog", VCS:"git", RepoRoot:"https://github.com/kubernetes/klog"} at //k8s.io/klog?go-get=1
k8s.io/klog (download)
github.com/go-logr/logr (download)
get "k8s.io/apimachinery/pkg/runtime": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/runtime?go-get=1
get "k8s.io/apimachinery/pkg/runtime": verifying non-authoritative meta tag
get "k8s.io/apimachinery/pkg/runtime/schema": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/runtime/schema?go-get=1
get "k8s.io/apimachinery/pkg/runtime/schema": verifying non-authoritative meta tag
get "k8s.io/apimachinery/pkg/types": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/types?go-get=1
get "k8s.io/apimachinery/pkg/types": verifying non-authoritative meta tag
get "k8s.io/apimachinery/pkg/util/intstr": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at //k8s.io/apimachinery/pkg/util/intstr?go-get=1
get "k8s.io/apimachinery/pkg/util/intstr": verifying non-authoritative meta tag
get "golang.org/x/net/http2": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at //golang.org/x/net/http2?go-get=1
get "golang.org/x/net/http2": verifying non-authoritative meta tag
golang.org/x/net (download)
get "golang.org/x/text/secure/bidirule": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text/secure/bidirule?go-get=1
get "golang.org/x/text/secure/bidirule": verifying non-authoritative meta tag
golang.org/x/text (download)
get "golang.org/x/text/unicode/bidi": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text/unicode/bidi?go-get=1
get "golang.org/x/text/unicode/bidi": verifying non-authoritative meta tag
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
get "k8s.io/client-go/kubernetes": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at //k8s.io/client-go/kubernetes?go-get=1
get "k8s.io/client-go/kubernetes": verifying non-authoritative meta tag
k8s.io/client-go (download)
github.com/golang/protobuf (download)
github.com/googleapis/gnostic (download)
package github.com/googleapis/gnostic/OpenAPIv2: cannot find package "github.com/googleapis/gnostic/OpenAPIv2" in any of:
        /usr/local/go/src/github.com/googleapis/gnostic/OpenAPIv2 (from $GOROOT)
        /go/src/github.com/googleapis/gnostic/OpenAPIv2 (from $GOPATH)
github.com/json-iterator/go (download)
github.com/modern-go/concurrent (download)
github.com/modern-go/reflect2 (download)
get "sigs.k8s.io/yaml": found meta tag get.metaImport{Prefix:"sigs.k8s.io/yaml", VCS:"git", RepoRoot:"https://github.com/kubernetes-sigs/yaml"} at //sigs.k8s.io/yaml?go-get=1
sigs.k8s.io/yaml (download)
get "k8s.io/client-go/rest": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at //k8s.io/client-go/rest?go-get=1
get "k8s.io/client-go/rest": verifying non-authoritative meta tag
github.com/davecgh/go-spew (download)
get "golang.org/x/crypto/ssh/terminal": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at //golang.org/x/crypto/ssh/terminal?go-get=1
get "golang.org/x/crypto/ssh/terminal": verifying non-authoritative meta tag
golang.org/x/crypto (download)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
golang.org/x/sys (download)
get "golang.org/x/oauth2": found meta tag get.metaImport{Prefix:"golang.org/x/oauth2", VCS:"git", RepoRoot:"https://go.googlesource.com/oauth2"} at //golang.org/x/oauth2?go-get=1
golang.org/x/oauth2 (download)
get "golang.org/x/time/rate": found meta tag get.metaImport{Prefix:"golang.org/x/time", VCS:"git", RepoRoot:"https://go.googlesource.com/time"} at //golang.org/x/time/rate?go-get=1
get "golang.org/x/time/rate": verifying non-authoritative meta tag
golang.org/x/time (download)
get "k8s.io/utils/integer": found meta tag get.metaImport{Prefix:"k8s.io/utils", VCS:"git", RepoRoot:"https://github.com/kubernetes/utils"} at //k8s.io/utils/integer?go-get=1
get "k8s.io/utils/integer": verifying non-authoritative meta tag
k8s.io/utils (download)
get "k8s.io/client-go/tools/cache": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at //k8s.io/client-go/tools/cache?go-get=1
get "k8s.io/client-go/tools/cache": verifying non-authoritative meta tag
github.com/hashicorp/golang-lru (download)
github.com/google/go-cmp (download)
Error: error building at STEP "RUN go get -d -v": error while running runtime: exit status 1

The error seems to be here?

package github.com/googleapis/gnostic/OpenAPIv2: cannot find package "github.com/googleapis/gnostic/OpenAPIv2" in any of:
        /usr/local/go/src/github.com/googleapis/gnostic/OpenAPIv2 (from $GOROOT)
        /go/src/github.com/googleapis/gnostic/OpenAPIv2 (from $GOPATH)
@mathieu-benoit mathieu-benoit added help wanted Extra attention is needed good first issue Good for newcomers labels Feb 1, 2020
@mathieu-benoit
Copy link
Contributor Author

Not sure if it's directly related but just found this: google/gnostic#155

@mathieu-benoit
Copy link
Contributor Author

Definitely looks like related to this: kubernetes/client-go#741

@howardjones
Copy link

howardjones commented Feb 4, 2020

How do you specify a version in an import?
I tried adding go get k8s.io/client-go@v0.17.2 before the existing go get in the Dockerfile, but I get cannot use path@version syntax in GOPATH mode.
I'm not a go person, but this seemed to be related to using a different structure for the libraries.

@joshjohanning
Copy link

joshjohanning commented Feb 4, 2020

I think if/when this pull request is approved, this should help us out. kubernetes/kubernetes#87802

edit-nvm

@maximsapiens
Copy link

I made it works in this way, by modifying captainkube Dockerfile, like as follows below:

# Build
FROM golang:1.13.4 as builder

WORKDIR /build
COPY main.go .
RUN GO111MODULE=on; go mod init captainkube && go get k8s.io/client-go@v0.17.2 && go get -d -v
# temporary workaroud for https://github.com/Azure/phippyandfriends/issues/30
#RUN cd $GOPATH/src/k8s.io/klog && git checkout v0.4.0 && cd -
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

# Run
FROM alpine:latest  

RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /build/app .
CMD ["./app"]

So, if briefly, change this line:
RUN GO111MODULE=on; go mod init captainkube && go get k8s.io/client-go@v0.17.2 && go get -d -v
And comment out this line:
#RUN cd $GOPATH/src/k8s.io/klog && git checkout v0.4.0 && cd -
Thats all.

@mathieu-benoit
Copy link
Contributor Author

Thanks @maximsapiens, you got it! That's indeed fix the issue accordingly. And yes you are right we could now remove the temporary workaround we did there: #31.

Thanks for your contribution on this @maximsapiens, @soccerjoshj07 and @howardjones!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants