11version : 2
22jobs :
33 build :
4- working_directory : /go/src
54 environment :
65 - PACKAGE_PATH : " github.com/inloco/kafka-elasticsearch-injector"
7- - LOCAL_BIN_PATH : " ~/bin:$PATH"
86 docker :
9- - image : circleci/golang:1.10
7+ - image : circleci/golang:1.12
108 environment :
119 DOCKER_REPO : inlocomedia/kafka-elasticsearch-injector-go
1210 - image : confluentinc/cp-zookeeper:3.1.1
@@ -21,57 +19,27 @@ jobs:
2119 - SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=localhost:2181
2220 - SCHEMA_REGISTRY_HOST_NAME=localhost
2321 - SCHEMA_REGISTRY_LISTENERS=http://localhost:8081
24- - image : elasticsearch:5-alpine
22+ - image : docker.elastic.co/ elasticsearch/elasticsearch-oss:7.0.0
2523 environment :
2624 ES_JAVA_OPTS : -Xms750m -Xmx750m
2725 discovery.type : single-node
2826 http.host : 0.0.0.0
2927 transport.host : 127.0.0.1
3028 steps :
31- - checkout :
32- path : $PACKAGE_PATH
33- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
29+ - checkout
3430 - run :
3531 name : Generate helper files
36- command : |
37- echo $(git rev-parse --short HEAD) > HEAD
38- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
32+ command : echo $(git rev-parse --short HEAD) > HEAD
3933 - setup_remote_docker :
4034 reusable : true
4135 - run :
4236 name : Login to Docker Hub
4337 command : |
4438 docker info
4539 docker login --username $DOCKER_USER --password $DOCKER_PASSWORD
46- - run :
47- name : " Make golang get play nice with repositories"
48- command : |
49- git config --global http.https://gopkg.in.followRedirects true
50- git config --global url."[email protected] :".insteadOf "https://bitbucket.org/" 51- git config --global url."[email protected] :".insteadOf "https://github.com/" 52- cat ~/.gitconfig
53- ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
54- ssh-keyscan github.com >> ~/.ssh/known_hosts
55- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
56- - run :
57- name : " Install dep"
58- command : curl https://raw.githubusercontent.com/golang/dep/v0.5.0/install.sh | sh
59- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
6040 - restore_cache :
6141 keys :
62- - kafka-elasticsearch-injector-go-{{ .Branch }}-{{ checksum "/go/src/github.com/inloco/kafka-elasticsearch-injector/Gopkg.lock" }}
63- - kafka-elasticsearch-injector-go-develop-{{ checksum "/go/src/github.com/inloco/kafka-elasticsearch-injector/Gopkg.lock" }}
64- - run :
65- name : " Install package deps"
66- command : |
67- if [ ! -d "vendor/" ]; then
68- dep ensure -v
69- fi
70- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
71- - save_cache :
72- key : kafka-elasticsearch-injector-go-{{ .Branch }}-{{ checksum "/go/src/github.com/inloco/kafka-elasticsearch-injector/Gopkg.lock" }}
73- paths :
74- - /go/src/github.com/inloco/kafka-elasticsearch-injector/vendor
42+ - go-mod-v4-{{ checksum "go.sum" }}
7543 - run :
7644 name : " Make sure elasticsearch is up and running"
7745 command : |
@@ -81,16 +49,17 @@ jobs:
8149 - run :
8250 name : " Run project tests (excluding vendor)"
8351 command : go test $(go list ./... | grep -v /vendor/)
84- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
8552 - run :
8653 name : Build injector
8754 command : GOOS=linux GOARCH=386 go build -a --ldflags="-s" -o bin/injector cmd/injector.go
88- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
8955 - run :
9056 name : Build injector docker image
9157 command : |
9258 docker build --rm=false -t "${DOCKER_REPO}:ci" -f cmd/Dockerfile .
93- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
59+ - save_cache :
60+ key : go-mod-v4-{{ checksum "go.sum" }}
61+ paths :
62+ - " /go/pkg/mod"
9463 - deploy :
9564 name : Push to Docker Hub
9665 command : |
10978 docker tag "${DOCKER_REPO}:ci" "${DOCKER_REPO}:$(cat VERSION)-$(cat HEAD)"
11079 docker push "${DOCKER_REPO}:$(cat VERSION)-$(cat HEAD)"
11180 fi
112- pwd : /go/src/github.com/inloco/kafka-elasticsearch-injector
0 commit comments