Skip to content

Commit

Permalink
Merge pull request #1434 from cyberark/fix-ci-go-errors
Browse files Browse the repository at this point in the history
Update to Go 1.16
  • Loading branch information
szh authored Nov 3, 2021
2 parents 47d06d4 + 2e520e3 commit 71c3de2
Show file tree
Hide file tree
Showing 25 changed files with 655 additions and 191 deletions.
7 changes: 7 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ plugins:
- HACK
- XXX
- BUG
exclude_patterns:
# Exclude `context.T O D O()` false positives
- "internal/configurationmanagers/kubernetes/"
- "internal/providers/kubernetessecrets/"
- "test/providers/kubernetessecrets/"

# ---------------
# Commonly-used languages - run time is minimal and all of these will work
Expand Down Expand Up @@ -188,3 +193,5 @@ plugins:
# commented if no files to exclude as an empty array will error
exclude_patterns:
- ".gitignore"
# Exclude autogenerated code
- "pkg/k8sclient/"
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Uninstall old go
- run: brew uninstall [email protected]
# Install go1.16
- run: brew install [email protected]
# Add go1.16 to PATH
- run: echo "/usr/local/opt/[email protected]/bin" >> $GITHUB_PATH
# Get go version
- run: go version
# Fix go1.16 module bug (https://github.com/golang/go/issues/44129#issuecomment-865249631)
- run: go env -w GOFLAGS=-mod=mod
# Download go modules
- run: go mod download
# Run keychain tests
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-buster as secretless-builder
FROM golang:1.16-buster as secretless-builder
MAINTAINER CyberArk Software Ltd.
LABEL builder="secretless-builder"

Expand All @@ -23,6 +23,7 @@ ENV GOOS=linux \
COPY go.mod go.sum /secretless/
COPY third_party/ /secretless/third_party

RUN go env -w GOFLAGS=-mod=mod
RUN go mod download

# secretless source files
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-buster as secretless-builder
FROM golang:1.16-buster as secretless-builder
MAINTAINER CyberArk Software Ltd.
LABEL builder="secretless-builder"

Expand All @@ -23,6 +23,7 @@ ENV GOOS=linux \
COPY go.mod go.sum /secretless/
COPY third_party/ /secretless/third_party

RUN go env -w GOFLAGS=-mod=mod
RUN go mod download

# Compile Delve (for debugging)
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-buster
FROM golang:1.16-buster
MAINTAINER CyberArk Software Ltd.

# On CyberArk dev laptops, golang module dependencies are downloaded with a
Expand Down Expand Up @@ -53,6 +53,7 @@ RUN go get -u github.com/jstemmer/go-junit-report && \
COPY go.mod go.sum /secretless/
COPY third_party/ /secretless/third_party

RUN go env -w GOFLAGS=-mod=mod
RUN go mod download

# TODO: all the stuff below this line is not needed
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-alpine
FROM golang:1.16-alpine
MAINTAINER CyberArk Software Ltd.
LABEL id="secretless-test-runner"

Expand All @@ -24,6 +24,7 @@ RUN apk add -u curl \
COPY go.mod go.sum /secretless/
COPY third_party/ /secretless/third_party

RUN go env -w GOFLAGS=-mod=mod
RUN go mod download

# go-junit-report => Convert go test output to junit xml
Expand Down
11 changes: 4 additions & 7 deletions bin/Dockerfile.codegen
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
FROM golang:1.12.5
FROM golang:1.16

WORKDIR /

ENV GO111MODULE=on

RUN git clone --depth 1 \
-b fix-runners \
https://github.com/conjurinc/code-generator.git && \
cd /code-generator && \
./build_generators && \
cp -r dist/* /usr/local/bin
ARG K8S_PKG_TAG

RUN git clone --depth 1 --branch ${K8S_PKG_TAG} https://github.com/kubernetes/code-generator.git

WORKDIR /secretless
15 changes: 11 additions & 4 deletions bin/codegen
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ TOPLEVEL_DIR="$CURRENT_DIR/.."
PROJECT_MODULE="github.com/cyberark/secretless-broker"
IMAGE_NAME="secretless-codegen-builder"

echo "Pre-cleaning..."
rm -rf "$TOPLEVEL_DIR/github.com"
K8S_PKG_TAG="$(go list -m -f '{{ .Version }}' k8s.io/client-go)"

echo "Building codegen Docker image..."
docker build -f "${CURRENT_DIR}/Dockerfile.codegen" \
--build-arg K8S_PKG_TAG="${K8S_PKG_TAG}" \
-t "${IMAGE_NAME}" \
"${TOPLEVEL_DIR}"

echo "Pre-cleaning..."
docker run --rm \
-v "${TOPLEVEL_DIR}:/secretless" \
"${IMAGE_NAME}" /bin/bash -c "rm -rf github.com"

runner_cmd="/code-generator/generate-groups.sh all \
$PROJECT_MODULE/pkg/k8sclient \
$PROJECT_MODULE/pkg/apis \
Expand All @@ -25,12 +30,14 @@ docker run --rm \
-t \
-e GOPATH="" \
-v "${TOPLEVEL_DIR}:/secretless" \
"${IMAGE_NAME}" "$runner_cmd"
"${IMAGE_NAME}" /bin/bash -c "$runner_cmd"

echo "Moving the code in the right places..."
cp -r "$TOPLEVEL_DIR/$PROJECT_MODULE/pkg" "$TOPLEVEL_DIR"

echo "Removing temp files..."
rm -rf "$TOPLEVEL_DIR/github.com"
docker run --rm \
-v "${TOPLEVEL_DIR}:/secretless" \
"${IMAGE_NAME}" /bin/bash -c "rm -rf github.com"

echo "Code-gen done!"
36 changes: 13 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/cyberark/secretless-broker

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.15.79
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/codegangsta/cli v1.20.0
Expand All @@ -15,43 +15,33 @@ require (
github.com/docker/docker v1.4.2-0.20191231165639-e6f6c35b7902
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/fsnotify/fsnotify v1.4.9
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/googleapis/gnostic v0.3.1 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/vault/api v1.0.2
github.com/heptiolabs/healthcheck v0.0.0-20180807145615-6ff867650f40
github.com/imdario/mergo v0.3.8 // indirect
github.com/joho/godotenv v1.2.0
github.com/json-iterator/go v1.1.8 // indirect
github.com/keybase/go-keychain v0.0.0-20201121013009-976c83ec27a6
github.com/kr/pretty v0.2.1 // indirect
github.com/lib/pq v0.0.0-20180123210206-19c8e9ad0095
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/pkg/errors v0.9.1
github.com/pkg/profile v1.2.1
github.com/prometheus/client_golang v1.2.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
github.com/spf13/pflag v1.0.5 // indirect
github.com/smartystreets/goconvey v1.6.4
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f
golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 // indirect
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
google.golang.org/grpc v1.41.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/yaml.v2 v2.2.3
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gotest.tools v2.2.0+incompatible // indirect
k8s.io/api v0.0.0-20180712090710-2d6f90ab1293
k8s.io/apiextensions-apiserver v0.0.0-20180808065829-408db4a50408
k8s.io/apimachinery v0.0.0-20180621070125-103fd098999d
k8s.io/client-go v0.0.0-20180806134042-1f13a808da65
k8s.io/api v0.22.3
k8s.io/apiextensions-apiserver v0.22.3
k8s.io/apimachinery v0.22.3
k8s.io/client-go v0.22.3
)

replace github.com/denisenkom/go-mssqldb => ./third_party/go-mssqldb
Expand All @@ -60,4 +50,4 @@ replace github.com/denisenkom/go-mssqldb => ./third_party/go-mssqldb
// This is our fix:
replace honnef.co/go/tools => github.com/dominikh/go-tools v0.0.1-2019.2.3

go 1.15
go 1.16
Loading

0 comments on commit 71c3de2

Please sign in to comment.