1
+ # Copyright 2019 AppsCode Inc.
2
+ # Copyright 2016 The Kubernetes Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
1
16
SHELL =/bin/bash -o pipefail
2
17
3
18
# The binary to build (just the basename).
@@ -54,7 +69,7 @@ TAG := $(VERSION)_$(OS)_$(ARCH)
54
69
TAG_PROD := $(TAG )
55
70
TAG_DBG := $(VERSION ) -dbg_$(OS ) _$(ARCH )
56
71
57
- GO_VERSION ?= 1.12.5
72
+ GO_VERSION ?= 1.12.7
58
73
BUILD_IMAGE ?= appscode/golang-dev:$(GO_VERSION ) -stretch
59
74
60
75
OUTBIN = bin/$(OS ) _$(ARCH ) /$(BIN )
@@ -111,7 +126,7 @@ version:
111
126
@echo commit_timestamp=$(commit_timestamp )
112
127
113
128
gen :
114
- ./hack/codegen.sh
129
+ @true
115
130
116
131
fmt : $(BUILD_DIRS )
117
132
@docker run \
@@ -164,9 +179,21 @@ $(OUTBIN): .go/$(OUTBIN).stamp
164
179
commit_timestamp=$(commit_timestamp ) \
165
180
./hack/build.sh \
166
181
"
167
- @if [ $( COMPRESS) = yes ] && [ $( OS) != windows ]; then \
168
- echo " compressing $( OUTBIN) " ; \
169
- upx --brute .go/$(OUTBIN ) ; \
182
+ @if [ $( COMPRESS) = yes ] && [ $( OS) != darwin ]; then \
183
+ echo " compressing $( OUTBIN) " ; \
184
+ docker run \
185
+ -i \
186
+ --rm \
187
+ -u $$(id -u ) :$$(id -g ) \
188
+ -v $$(pwd ) :/src \
189
+ -w /src \
190
+ -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin \
191
+ -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin/$(OS ) _$(ARCH ) \
192
+ -v $$(pwd ) /.go/cache:/.cache \
193
+ --env HTTP_PROXY=$(HTTP_PROXY ) \
194
+ --env HTTPS_PROXY=$(HTTPS_PROXY ) \
195
+ $(BUILD_IMAGE ) \
196
+ upx --brute /go/$(OUTBIN ) ; \
170
197
fi
171
198
@if ! cmp -s .go/$(OUTBIN ) $(OUTBIN ) ; then \
172
199
mv .go/$(OUTBIN ) $(OUTBIN ) ; \
@@ -188,7 +215,7 @@ bin/.container-$(DOTFILE_IMAGE)-%: bin/$(OS)_$(ARCH)/$(BIN) $(DOCKERFILE_%)
188
215
-e ' s|{RESTIC_VER}|$(RESTIC_VER)|g' \
189
216
-e ' s|{NEW_RESTIC_VER}|$(NEW_RESTIC_VER)|g' \
190
217
$(DOCKERFILE_$* ) > bin/.dockerfile-$* -$(OS ) _$(ARCH )
191
- @docker build -t $(IMAGE ) :$(TAG_$* ) -f bin/.dockerfile-$* -$(OS ) _$(ARCH ) .
218
+ @docker build --pull - t $(IMAGE ) :$(TAG_$* ) -f bin/.dockerfile-$* -$(OS ) _$(ARCH ) .
192
219
@docker images -q $(IMAGE ) :$(TAG_$* ) > $@
193
220
@echo
194
221
@@ -255,28 +282,28 @@ dev: gen fmt push
255
282
ci : lint test build # cover
256
283
257
284
.PHONY : qa
258
- qa : docker-manifest
285
+ qa :
259
286
@if [ " $$ APPSCODE_ENV" = " prod" ]; then \
260
287
echo " Nothing to do in prod env. Are you trying to 'release' binaries to prod?" ; \
261
288
exit 1; \
262
289
fi
263
- @if [ " $( version_strategy) " = " git_tag " ]; then \
290
+ @if [ " $( version_strategy) " = " tag " ]; then \
264
291
echo " Are you trying to 'release' binaries to prod?" ; \
265
292
exit 1; \
266
293
fi
267
- @$(MAKE ) clean all-push --no-print-directory
294
+ @$(MAKE ) clean all-push docker-manifest --no-print-directory
268
295
269
296
.PHONY : release
270
- release : docker-manifest
297
+ release :
271
298
@if [ " $$ APPSCODE_ENV" != " prod" ]; then \
272
299
echo " 'release' only works in PROD env." ; \
273
300
exit 1; \
274
301
fi
275
- @if [ " $( version_strategy) " != " git_tag " ]; then \
276
- echo " 'apply_tag' to release binaries and/or docker images." ; \
277
- exit 1; \
302
+ @if [ " $( version_strategy) " != " tag " ]; then \
303
+ echo " apply tag to release binaries and/or docker images." ; \
304
+ exit 1; \
278
305
fi
279
- @$(MAKE ) clean all-push --no-print-directory
306
+ @$(MAKE ) clean all-push docker-manifest --no-print-directory
280
307
281
308
.PHONY : clean
282
309
clean :
0 commit comments