Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Re-vendor openapiv2 to fix case change breaking Docker build #186

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ryanbrainard
Copy link

gnostic/openapiv2 lowercased their repo name, which is breaking the Docker build in this project:

$ docker build 'https://github.com/opsgenie/kubernetes-event-exporter.git#master'                
[+] Building 1.9s (8/9)                                                                                                                                              
 => CACHED [internal] load git source https://github.com/opsgenie/kubernetes-event-exporter.git#master                                                          0.0s
 => [internal] load metadata for gcr.io/distroless/base:latest                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/golang:1.17                                                                                                  1.2s
 => [builder 1/4] FROM docker.io/library/golang:1.17@sha256:b983574376a29f21ccba0a90f1e1f31864d084cee73295b774305b792b31b8bd                                    0.0s
 => [stage-1 1/2] FROM gcr.io/distroless/base                                                                                                                   0.0s
 => CACHED [builder 2/4] ADD . /app                                                                                                                             0.0s
 => CACHED [builder 3/4] WORKDIR /app                                                                                                                           0.0s
 => ERROR [builder 4/4] RUN CGO_ENABLED=0 GOOS=linux GO11MODULE=on go build -mod=vendor -a -o /main .                                                           0.7s
------
 > [builder 4/4] RUN CGO_ENABLED=0 GOOS=linux GO11MODULE=on go build -mod=vendor -a -o /main .:
#7 0.631 vendor/k8s.io/client-go/discovery/discovery_client.go:31:2: cannot find package "." in:
#7 0.631        /app/vendor/github.com/googleapis/gnostic/openapiv2
------
executor failed running [/bin/sh -c CGO_ENABLED=0 GOOS=linux GO11MODULE=on go build -mod=vendor -a -o /main .]: exit code: 1

This change deletes vendor/github.com/googleapis/gnostic/OpenAPIv2, re-runs go mod vendor, and adds the new vendor/github.com/googleapis/gnostic/openapiv2. Note, it was done two commits to deal with MacOS's case insensitivity that otherwise would not detect the change.

Correctly working build on this fork/branch:

$ docker build 'https://github.com/ryanbrainard/kubernetes-event-exporter.git#fix-vendor-openapi'                                                              1 ↵
[+] Building 2.9s (11/11) FINISHED                                                                                                                                   
 => CACHED [internal] load git source https://github.com/ryanbrainard/kubernetes-event-exporter.git#fix-vendor-openapi                                          0.0s
 => [internal] load metadata for docker.io/library/golang:1.17                                                                                                  2.8s
 => [internal] load metadata for gcr.io/distroless/base:latest                                                                                                  0.0s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                   0.0s
 => [stage-1 1/2] FROM gcr.io/distroless/base                                                                                                                   0.0s
 => [builder 1/4] FROM docker.io/library/golang:1.17@sha256:b983574376a29f21ccba0a90f1e1f31864d084cee73295b774305b792b31b8bd                                    0.0s
 => CACHED [builder 2/4] ADD . /app                                                                                                                             0.0s
 => CACHED [builder 3/4] WORKDIR /app                                                                                                                           0.0s
 => CACHED [builder 4/4] RUN CGO_ENABLED=0 GOOS=linux GO11MODULE=on go build -mod=vendor -a -o /main .                                                          0.0s
 => CACHED [stage-1 2/2] COPY --from=builder --chown=nonroot:nonroot /main /kubernetes-event-exporter                                                           0.0s
 => exporting to image                                                                                                                                          0.0s
 => => exporting layers                                                                                                                                         0.0s
 => => writing image sha256:7eeea331f6b86d8047c63ac7f1519b6543749e9fd0099d9b0278e9ee2a51186f                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant