Skip to content

Commit

Permalink
Merge pull request #263 from mwhittington21/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependencies
  • Loading branch information
struz authored Mar 5, 2020
2 parents b768dc9 + 15c2f63 commit 472b462
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 421 deletions.
7 changes: 2 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.idea/
build/bin/darwin/
cmd/
iptables/
version/
vendor/
build/bin/darwin
vendor/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- docker

go:
- 1.10.x
- 1.14.x

os:
- linux
Expand All @@ -31,4 +31,4 @@ after_success:
make release;
else
echo "Not executing release on non-tag build";
fi
fi
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
FROM alpine:3.9
FROM golang:1.14.0 AS BUILDER
WORKDIR /go/src/github.com/jtblin/kube2iam
ENV ARCH=linux
ENV CGO_ENABLED=0
COPY . ./
RUN make setup && make build

FROM alpine:3.11.3
RUN apk --no-cache add \
ca-certificates \
iptables

COPY build/bin/linux/kube2iam /bin/kube2iam

COPY --from=BUILDER /go/src/github.com/jtblin/kube2iam/build/bin/linux/kube2iam /bin/kube2iam
ENTRYPOINT ["kube2iam"]
46 changes: 16 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ GOBUILD_VERSION_ARGS := -ldflags "-s -X $(VERSION_VAR)=$(REPO_VERSION) -X $(GIT_
DOCKER_REPO ?= jtblin
IMAGE_NAME := $(DOCKER_REPO)/$(BINARY_NAME)
ARCH ?= darwin
METALINTER_CONCURRENCY ?= 4
METALINTER_DEADLINE ?= 180
GOLANGCI_LINT_VERSION ?= v1.23.8
GOLANGCI_LINT_CONCURRENCY ?= 4
GOLANGCI_LINT_DEADLINE ?= 180
# useful for passing --build-arg http_proxy :)
DOCKER_BUILD_FLAGS :=

setup:
go get -v -u github.com/Masterminds/glide
go get -v -u github.com/githubnemo/CompileDaemon
go get -v -u github.com/alecthomas/gometalinter
go get -v -u golang.org/x/tools/cmd/goimports
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.23.8
go get -v -u github.com/jstemmer/go-junit-report
go get -v github.com/mattn/goveralls
gometalinter --install --update
glide install --strip-vendor

build: *.go fmt
go build -o build/bin/$(ARCH)/$(BINARY_NAME) $(GOBUILD_VERSION_ARGS) github.com/jtblin/$(BINARY_NAME)/cmd
Expand All @@ -33,23 +31,23 @@ build-race: *.go fmt
go build -race -o build/bin/$(ARCH)/$(BINARY_NAME) $(GOBUILD_VERSION_ARGS) github.com/jtblin/$(BINARY_NAME)/cmd

build-all:
go build $$(glide nv)
go build ./...

fmt:
gofmt -w=true -s $$(find . -type f -name '*.go' -not -path "./vendor/*")
goimports -w=true -d $$(find . -type f -name '*.go' -not -path "./vendor/*")
gofmt -w=true -s $$(find . -type f -name '*.go')
goimports -w=true -d $$(find . -type f -name '*.go')

test:
go test $$(glide nv)
go test ./...

test-race:
go test -race $$(glide nv)
go test -race ./...

bench:
go test -bench=. $$(glide nv)
go test -bench=. ./...

bench-race:
go test -race -bench=. $$(glide nv)
go test -race -bench=. ./...

cover:
./cover.sh
Expand All @@ -61,29 +59,19 @@ coveralls:
goveralls -coverprofile=coverage.out -service=travis-ci

junit-test: build
go test -v $$(glide nv) | go-junit-report > test-report.xml
go test -v ./... | go-junit-report > test-report.xml

check:
go install ./cmd

gometalinter --concurrency=$(METALINTER_CONCURRENCY) --deadline=$(METALINTER_DEADLINE)s ./... --vendor --linter='errcheck:errcheck:-ignore=net:Close' --cyclo-over=20 \
--linter='vet:go vet --no-recurse -composites=false:PATH:LINE:MESSAGE' --disable=interfacer --dupl-threshold=50
golangci-lint run --enable=gocyclo --concurrency=$(GOLANGCI_LINT_CONCURRENCY) --deadline=$(GOLANGCI_LINT_DEADLINE)s

check-all:
go install ./cmd
gometalinter --concurrency=$(METALINTER_CONCURRENCY) --deadline=600s ./... --vendor --cyclo-over=20 \
--linter='vet:govet --no-recurse:PATH:LINE:MESSAGE' --dupl-threshold=50
--dupl-threshold=50
golangci-lint run --enable=gocyclo --concurrency=$(GOLANGCI_LINT_CONCURRENCY) --deadline=600s

travis-checks: build test-race check bench-race

watch:
CompileDaemon -color=true -build "make test"

cross:
CGO_ENABLED=0 GOOS=linux go build -o build/bin/linux/$(BINARY_NAME) $(GOBUILD_VERSION_ARGS) -a -installsuffix cgo github.com/jtblin/$(BINARY_NAME)/cmd

docker: cross
docker:
docker build -t $(IMAGE_NAME):$(GIT_HASH) . $(DOCKER_BUILD_FLAGS)

docker-dev: docker
Expand All @@ -104,7 +92,5 @@ version:

clean:
rm -rf build/bin/*
-docker rm $(docker ps -a -f 'status=exited' -q)
-docker rmi $(docker images -f 'dangling=true' -q)

.PHONY: build version
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,6 @@ Usage of kube2iam:
* Retrieve the services url: `minikube service kube2iam --url`
* Test your changes e.g. `curl -is $(minikube service kube2iam --url)/healthz`

### Building
* If using newer version of go:

* Disable Go Modules:
```
export GO111MODULE=off
```
* Code should be under `$GOPATH`

# Author

Jerome Touffe-Blin, [@jtblin](https://twitter.com/jtblin), [About me](http://about.me/jtblin)
Expand Down
Loading

0 comments on commit 472b462

Please sign in to comment.