Skip to content

Commit dcef9dc

Browse files
authored
Use go mod (#2314)
* Modify Docker files and Makefile accordingly
1 parent 3ef6d2f commit dcef9dc

File tree

9 files changed

+522
-43
lines changed

9 files changed

+522
-43
lines changed

Dockerfile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
ARG TARGET=server
22

3+
# Can be used in case a proxy is necessary
4+
ARG GOPROXY
5+
36
# Build Cadence binaries
47
FROM golang:1.12.7-alpine AS builder
58

69
RUN apk add --update --no-cache ca-certificates make git curl mercurial bzr
710

8-
WORKDIR /go/src/github.com/uber/cadence
11+
WORKDIR /cadence
12+
13+
# Making sure that dependency is not touched
14+
ENV GOFLAGS="-mod=readonly"
915

10-
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh
11-
COPY Gopkg.* ./
12-
RUN dep ensure -v -vendor-only
16+
# Copy go mod dependencies and build cache
17+
COPY go.* .
18+
RUN go mod download
1319

1420
COPY . .
15-
RUN sed -i 's/dep-ensured//g' Makefile
1621
RUN CGO_ENABLED=0 make copyright cadence-cassandra-tool cadence-sql-tool cadence cadence-server
1722

1823

@@ -46,11 +51,11 @@ ENV CADENCE_HOME /etc/cadence
4651
RUN mkdir -p /etc/cadence
4752

4853
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin
49-
COPY --from=builder /go/src/github.com/uber/cadence/cadence-cassandra-tool /usr/local/bin
50-
COPY --from=builder /go/src/github.com/uber/cadence/cadence-sql-tool /usr/local/bin
51-
COPY --from=builder /go/src/github.com/uber/cadence/cadence /usr/local/bin
52-
COPY --from=builder /go/src/github.com/uber/cadence/cadence-server /usr/local/bin
53-
COPY --from=builder /go/src/github.com/uber/cadence/schema /etc/cadence/schema
54+
COPY --from=builder /cadence/cadence-cassandra-tool /usr/local/bin
55+
COPY --from=builder /cadence/cadence-sql-tool /usr/local/bin
56+
COPY --from=builder /cadence/cadence /usr/local/bin
57+
COPY --from=builder /cadence/cadence-server /usr/local/bin
58+
COPY --from=builder /cadence/schema /etc/cadence/schema
5459

5560
COPY docker/entrypoint.sh /docker-entrypoint.sh
5661
COPY config/dynamicconfig /etc/cadence/config/dynamicconfig
@@ -79,7 +84,7 @@ CMD /start.sh
7984
# Cadence CLI
8085
FROM alpine AS cadence-cli
8186

82-
COPY --from=builder /go/src/github.com/uber/cadence/cadence /usr/local/bin
87+
COPY --from=builder /cadence/cadence /usr/local/bin
8388

8489
ENTRYPOINT ["cadence"]
8590

Makefile

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ PKG_TEST_DIRS := $(filter-out $(INTEG_TEST_ROOT)%,$(TEST_DIRS))
8181
# Packages are specified as import paths.
8282
GOCOVERPKG_ARG := -coverpkg="$(PROJECT_ROOT)/common/...,$(PROJECT_ROOT)/service/...,$(PROJECT_ROOT)/client/...,$(PROJECT_ROOT)/tools/..."
8383

84-
dep-ensured:
85-
./install-dep.sh
86-
dep ensure
87-
8884
yarpc-install:
85+
go mod vendor
8986
go get './vendor/go.uber.org/thriftrw'
9087
go get './vendor/go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc'
9188

@@ -97,38 +94,38 @@ thriftc: yarpc-install $(THRIFTRW_GEN_SRC)
9794
copyright: cmd/tools/copyright/licensegen.go
9895
GOOS= GOARCH= go run ./cmd/tools/copyright/licensegen.go --verifyOnly
9996

100-
cadence-cassandra-tool: dep-ensured $(TOOLS_SRC)
97+
cadence-cassandra-tool: $(TOOLS_SRC)
10198
go build -i -o cadence-cassandra-tool cmd/tools/cassandra/main.go
10299

103-
cadence-sql-tool: dep-ensured $(TOOLS_SRC)
100+
cadence-sql-tool: $(TOOLS_SRC)
104101
go build -i -o cadence-sql-tool cmd/tools/sql/main.go
105102

106-
cadence: dep-ensured $(TOOLS_SRC)
103+
cadence: $(TOOLS_SRC)
107104
go build -i -o cadence cmd/tools/cli/main.go
108105

109-
cadence-server: dep-ensured $(ALL_SRC)
106+
cadence-server: $(ALL_SRC)
110107
go build -ldflags '$(GO_BUILD_LDFLAGS)' -i -o cadence-server cmd/server/cadence.go cmd/server/server.go
111108

112109
bins_nothrift: lint copyright cadence-cassandra-tool cadence-sql-tool cadence cadence-server
113110

114111
bins: thriftc bins_nothrift
115112

116-
test: dep-ensured bins
113+
test: bins
117114
@rm -f test
118115
@rm -f test.log
119116
@for dir in $(TEST_DIRS); do \
120117
go test -timeout 20m -race -coverprofile=$@ "$$dir" $(TEST_TAG) | tee -a test.log; \
121118
done;
122119

123-
test_eventsV2: dep-ensured bins
120+
test_eventsV2: bins
124121
@rm -f test_eventsV2
125122
@rm -f test_eventsV2.log
126123
@echo Running integration test
127124
@for dir in $(INTEG_TEST_ROOT); do \
128125
go test -timeout 20m -coverprofile=$@ "$$dir" -v $(TEST_TAG) -eventsV2=true | tee -a test_eventsV2.log; \
129126
done;
130127

131-
test_eventsV2_xdc: dep-ensured bins
128+
test_eventsV2_xdc: bins
132129
@rm -f test_eventsV2_xdc
133130
@rm -f test_eventsV2_xdc.log
134131
@echo Running integration test for cross dc:
@@ -137,7 +134,7 @@ test_eventsV2_xdc: dep-ensured bins
137134
done;
138135

139136
# need to run xdc tests with race detector off because of ringpop bug causing data race issue
140-
test_xdc: dep-ensured bins
137+
test_xdc: bins
141138
@rm -f test
142139
@rm -f test.log
143140
@for dir in $(INTEG_TEST_XDC_ROOT); do \
@@ -185,7 +182,7 @@ cover_integration_ci: cover_integration_profile
185182
cover_xdc_ci: cover_xdc_profile
186183
goveralls -coverprofile=$(BUILD)/cover.out -service=travis-ci || echo -e "\x1b[31mCoveralls failed\x1b[m"; \
187184

188-
lint: dep-ensured
185+
lint:
189186
@echo Running linter
190187
@lintFail=0; for file in $(ALL_SRC); do \
191188
golint "$$file"; \

cmd/server/tools.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2019 Uber Technologies, Inc.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
21+
// +build tools
22+
23+
package tools
24+
25+
// the 2 dependency below are used for yarpc / thriftrw compatible code generation
26+
import (
27+
_ "go.uber.org/thriftrw"
28+
_ "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc"
29+
)

docker/buildkite/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ RUN go get github.com/axw/gocov/gocov
2828
RUN go get github.com/mattn/goveralls
2929
RUN go get golang.org/x/tools/cmd/cover
3030

31-
# The golang Docker sets the $GOPATH to be /go
3231
# https://github.com/docker-library/golang/blob/c1baf037d71331eb0b8d4c70cff4c29cf124c5e0/1.4/Dockerfile
33-
RUN mkdir -p /go/src/github.com/uber/cadence
34-
WORKDIR /go/src/github.com/uber/cadence
32+
RUN mkdir -p /cadence
33+
WORKDIR /cadence

docker/buildkite/docker-compose-local.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ services:
8181
- cassandra
8282
- mysql
8383
volumes:
84-
- ../../:/go/src/github.com/uber/cadence
84+
- ../../:/cadence
8585
networks:
8686
services-network:
8787
aliases:
@@ -112,7 +112,7 @@ services:
112112
- elasticsearch
113113
- kafka
114114
volumes:
115-
- ../../:/go/src/github.com/uber/cadence
115+
- ../../:/cadence
116116
networks:
117117
services-network:
118118
aliases:
@@ -144,7 +144,7 @@ services:
144144
- elasticsearch
145145
- kafka
146146
volumes:
147-
- ../../:/go/src/github.com/uber/cadence
147+
- ../../:/cadence
148148
networks:
149149
services-network:
150150
aliases:
@@ -175,7 +175,7 @@ services:
175175
- elasticsearch
176176
- kafka
177177
volumes:
178-
- ../../:/go/src/github.com/uber/cadence
178+
- ../../:/cadence
179179
networks:
180180
services-network:
181181
aliases:
@@ -206,7 +206,7 @@ services:
206206
- elasticsearch
207207
- kafka
208208
volumes:
209-
- ../../:/go/src/github.com/uber/cadence
209+
- ../../:/cadence
210210
networks:
211211
services-network:
212212
aliases:
@@ -238,7 +238,7 @@ services:
238238
- elasticsearch
239239
- kafka
240240
volumes:
241-
- ../../:/go/src/github.com/uber/cadence
241+
- ../../:/cadence
242242
networks:
243243
services-network:
244244
aliases:

docker/buildkite/docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ services:
7979
- cassandra
8080
- mysql
8181
volumes:
82-
- ../../:/go/src/github.com/uber/cadence
82+
- ../../:/cadence
8383
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
8484
networks:
8585
services-network:
@@ -109,7 +109,7 @@ services:
109109
- elasticsearch
110110
- kafka
111111
volumes:
112-
- ../../:/go/src/github.com/uber/cadence
112+
- ../../:/cadence
113113
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
114114
networks:
115115
services-network:
@@ -140,7 +140,7 @@ services:
140140
- elasticsearch
141141
- kafka
142142
volumes:
143-
- ../../:/go/src/github.com/uber/cadence
143+
- ../../:/cadence
144144
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
145145
networks:
146146
services-network:
@@ -170,7 +170,7 @@ services:
170170
- elasticsearch
171171
- kafka
172172
volumes:
173-
- ../../:/go/src/github.com/uber/cadence
173+
- ../../:/cadence
174174
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
175175
networks:
176176
services-network:
@@ -201,7 +201,7 @@ services:
201201
- elasticsearch
202202
- kafka
203203
volumes:
204-
- ../../:/go/src/github.com/uber/cadence
204+
- ../../:/cadence
205205
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
206206
networks:
207207
services-network:

go.mod

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
module github.com/uber/cadence
2+
3+
go 1.12
4+
5+
require (
6+
github.com/DataDog/zstd v1.4.0 // indirect
7+
github.com/Shopify/sarama v1.23.0
8+
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
9+
github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7
10+
github.com/benbjohnson/clock v0.0.0-20161215174838-7dc76406b6d3 // indirect
11+
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
12+
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
13+
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b // indirect
14+
github.com/bsm/sarama-cluster v2.1.15+incompatible
15+
github.com/cactus/go-statsd-client v3.1.1+incompatible
16+
github.com/cch123/elasticsql v0.0.0-20190321073543-a1a440758eb9
17+
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
18+
github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b // indirect
19+
github.com/davecgh/go-spew v1.1.1
20+
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2
21+
github.com/eapache/go-resiliency v1.2.0 // indirect
22+
github.com/emirpasic/gods v0.0.0-20190624094223-e689965507ab
23+
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
24+
github.com/fatih/color v0.0.0-20181010231311-3f9d52f7176a
25+
github.com/fatih/structtag v1.0.0 // indirect
26+
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
27+
github.com/fortytw2/leaktest v1.3.0 // indirect
28+
github.com/go-sql-driver/mysql v1.4.1
29+
github.com/gocql/gocql v0.0.0-20171220143535-56a164ee9f31
30+
github.com/gogo/googleapis v1.2.0 // indirect
31+
github.com/gogo/status v1.1.0 // indirect
32+
github.com/golang/mock v1.3.1
33+
github.com/google/uuid v1.1.1
34+
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
35+
github.com/hashicorp/go-version v1.2.0
36+
github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365
37+
github.com/jcmturner/gofork v1.0.0 // indirect
38+
github.com/jessevdk/go-flags v1.4.0 // indirect
39+
github.com/jmoiron/sqlx v1.2.0
40+
github.com/jonboulle/clockwork v0.1.0
41+
github.com/kisielk/errcheck v1.2.0 // indirect
42+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
43+
github.com/lib/pq v1.2.0 // indirect
44+
github.com/m3db/prometheus_client_golang v0.8.1
45+
github.com/m3db/prometheus_client_model v0.1.0 // indirect
46+
github.com/m3db/prometheus_common v0.1.0 // indirect
47+
github.com/m3db/prometheus_procfs v0.8.1 // indirect
48+
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
49+
github.com/mattn/go-colorable v0.0.9 // indirect
50+
github.com/mattn/go-isatty v0.0.8 // indirect
51+
github.com/mattn/go-runewidth v0.0.4 // indirect
52+
github.com/mattn/go-sqlite3 v1.11.0 // indirect
53+
github.com/olekukonko/tablewriter v0.0.1
54+
github.com/olivere/elastic v6.2.21+incompatible
55+
github.com/opentracing/opentracing-go v1.1.0
56+
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709
57+
github.com/pierrec/lz4 v0.0.0-20190701081048-057d66e894a4 // indirect
58+
github.com/pkg/errors v0.8.1 // indirect
59+
github.com/prashantv/protectmem v0.0.0-20171002184600-e20412882b3a // indirect
60+
github.com/prometheus/common v0.6.0 // indirect
61+
github.com/prometheus/procfs v0.0.3 // indirect
62+
github.com/robfig/cron v1.2.0
63+
github.com/samuel/go-thrift v0.0.0-20190219015601-e8b6b52668fe // indirect
64+
github.com/sirupsen/logrus v1.2.0
65+
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 // indirect
66+
github.com/stretchr/testify v1.3.0
67+
github.com/uber-common/bark v1.2.1 // indirect
68+
github.com/uber-go/atomic v1.4.0 // indirect
69+
github.com/uber-go/kafka-client v0.2.2
70+
github.com/uber-go/mapdecode v1.0.0 // indirect
71+
github.com/uber-go/tally v3.3.11+incompatible
72+
github.com/uber/jaeger-client-go v2.16.0+incompatible // indirect
73+
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
74+
github.com/uber/ringpop-go v0.8.5
75+
github.com/uber/tchannel-go v1.14.0
76+
github.com/urfave/cli v1.20.0
77+
github.com/valyala/fastjson v1.4.1
78+
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
79+
go.uber.org/atomic v1.4.0
80+
go.uber.org/cadence v0.0.0-20190702231331-27b0ba2bc456
81+
go.uber.org/dig v1.7.0 // indirect
82+
go.uber.org/fx v1.9.0 // indirect
83+
go.uber.org/goleak v0.10.0 // indirect
84+
go.uber.org/multierr v1.1.0
85+
go.uber.org/net/metrics v1.1.0 // indirect
86+
go.uber.org/thriftrw v1.20.0
87+
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect
88+
go.uber.org/yarpc v1.39.0
89+
go.uber.org/zap v1.10.0
90+
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
91+
golang.org/x/lint v0.0.0-20190409202823-959b441ac422 // indirect
92+
golang.org/x/net v0.0.0-20190628185345-da137c7871d7
93+
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect
94+
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
95+
golang.org/x/tools v0.0.0-20190703183924-abb7e64e8926 // indirect
96+
google.golang.org/appengine v1.6.1 // indirect
97+
google.golang.org/grpc v1.22.1 // indirect
98+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
99+
gopkg.in/inf.v0 v0.9.1 // indirect
100+
gopkg.in/jcmturner/goidentity.v3 v3.0.0 // indirect
101+
gopkg.in/jcmturner/gokrb5.v7 v7.3.0 // indirect
102+
gopkg.in/validator.v2 v2.0.0-20180514200540-135c24b11c19
103+
gopkg.in/yaml.v2 v2.2.2
104+
)
105+
106+
replace github.com/jmoiron/sqlx v1.2.0 => github.com/mfateev/sqlx v0.0.0-20180910213730-fa49b1cf03f7

0 commit comments

Comments
 (0)