-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
go version go1.8.3 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build655969460=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
Received the following error when trying to open a plugin:
plugin.Open: plugin was built with a different version of package errors
Now, this can happen when:
We should explicitly reject an attempt to open a plugin that was created by a different version of the Go toolchain.
However, here are reproducible steps that show that this is happening with the same version of go
$ git clone [email protected]:northwesternmutual/kanali.git && cd kanali
$ git checkout plugin-open
$ minikube start
$ ./scripts/install.sh # wait until all pods are in running state
$ kubectl apply -f ./examples/exampleSeven.yaml
$ curl --header 'apikey: 0HfVWylwxchODd3s4A7D9Zoel0Xo83iQ' --insecure $(minikube service kanali --url --format="https://{{.IP}}:{{.Port}}")/api/v1/example-seven
Here is the Dockerfile
being built above. As you can see, the same go installation is used to both compile both the program and the plugin:
ARG GO_VERSION=1.8.3
FROM golang:${GO_VERSION} AS build-stage
MAINTAINER [email protected]
ARG VERSION="unknown version"
ARG GLIDE_VERSION=0.12.3
WORKDIR /go/src/github.com/northwesternmutual/kanali/
COPY glide.lock glide.yaml Makefile /go/src/github.com/northwesternmutual/kanali/
RUN wget "https://github.com/Masterminds/glide/releases/download/v${GLIDE_VERSION}/glide-v${GLIDE_VERSION}-`go env GOHOSTOS`-`go env GOHOSTARCH`.tar.gz" -O /tmp/glide.tar.gz \
&& mkdir /tmp/glide \
&& tar --directory=/tmp/glide -xvf /tmp/glide.tar.gz \
&& rm -rf /tmp/glide.tar.gz
RUN export PATH=$PATH:/tmp/glide/`go env GOHOSTOS`-`go env GOHOSTARCH` \
&& make install
COPY ./ /go/src/github.com/northwesternmutual/kanali/
RUN sed -ie "s/changeme/`echo ${VERSION}`/g" /go/src/github.com/northwesternmutual/kanali/cmd/version.go
RUN curl -O https://raw.githubusercontent.com/northwesternmutual/kanali-plugin-apikey/master/plugin.go
RUN go build -buildmode=plugin -o apiKey.so plugin.go
RUN make build
FROM centos:latest
MAINTAINER [email protected]
RUN curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
COPY --from=build-stage /go/src/github.com/northwesternmutual/kanali/apiKey.so ./apiKey.so
COPY --from=build-stage /go/src/github.com/northwesternmutual/kanali/kanali .
ENTRYPOINT ["/kanali"]