vmware-archive / operator-builder

A Kubebuilder plugin to accelerate the development of Kubernetes operators
MIT License
41 stars 6 forks source link

Update docker build to handle private go repos #50

Open scottd018 opened 3 years ago

scottd018 commented 3 years ago

The following errors occur when accessing a private repo with docker build:

docker build -t scottd018/cnpo:0.1.0 .
Sending build context to Docker daemon  305.1MB
Step 1/14 : FROM golang:1.15 as builder
 ---> c62391fc0216
Step 2/14 : WORKDIR /workspace
 ---> Using cache
 ---> fa2dc9c64db8
Step 3/14 : COPY go.mod go.mod
 ---> Using cache
 ---> e82b11a984a3
Step 4/14 : COPY go.sum go.sum
 ---> Using cache
 ---> 2d2234aa3241
Step 5/14 : RUN go mod download
 ---> Using cache
 ---> 95086ef2ff7b
Step 6/14 : COPY main.go main.go
 ---> Using cache
 ---> 37f02b585946
Step 7/14 : COPY apis/ apis/
 ---> a5f56cade259
Step 8/14 : COPY controllers/ controllers/
 ---> 4968ee9526fc
Step 9/14 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
 ---> Running in f31581888a44
go: finding module for package gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/wait
go: finding module for package gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/dependencies
go: finding module for package gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/helpers
go: finding module for package gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/mutate
controllers/autoscaling/autoscalingcommoncomponent_controller.go:25:2: module gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/dependencies: git ls-remote -q origin in /go/pkg/mod/cache/vcs/fe1bcad8c9ca642edacdb3fb69e8ea12f0988188591800f827486cb215f6883b: exit status 128:
        fatal: could not read Username for 'https://gitlab.my.git.repo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
controllers/phases/dependency.go:15:2: module gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/helpers: git ls-remote -q origin in /go/pkg/mod/cache/vcs/fe1bcad8c9ca642edacdb3fb69e8ea12f0988188591800f827486cb215f6883b: exit status 128:
        fatal: could not read Username for 'https://gitlab.my.git.repo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
controllers/autoscaling/autoscalingcommoncomponent_controller.go:26:2: module gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/mutate: git ls-remote -q origin in /go/pkg/mod/cache/vcs/fe1bcad8c9ca642edacdb3fb69e8ea12f0988188591800f827486cb215f6883b: exit status 128:
        fatal: could not read Username for 'https://gitlab.my.git.repo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
controllers/autoscaling/autoscalingcommoncomponent_controller.go:27:2: module gitlab.my.git.repo.com/sdustin/cloud-native-platform-operator/pkg/wait: git ls-remote -q origin in /go/pkg/mod/cache/vcs/fe1bcad8c9ca642edacdb3fb69e8ea12f0988188591800f827486cb215f6883b: exit status 128:
        fatal: could not read Username for 'https://gitlab.my.git.repo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
lander2k2 commented 3 years ago

@scottd018 I may be missing something but isn't this solved by setting GOPRIVATE in your session?