@@ -33,6 +33,7 @@ SRC_DIRS = $(shell sh -c "find $(TOP_SRC_DIRS) -name \\*.go \
33
33
TEST_DIRS ?= $(shell sh -c "find $(TOP_SRC_DIRS ) -name \\* _test.go \
34
34
-exec dirname {} \\; | sort | uniq")
35
35
VERSION ?= $(shell git describe --always --abbrev=7 --dirty)
36
+ BUILD_LDFLAGS = $(shell build/version.sh $(ROOT ) $(SC_PKG ) )
36
37
37
38
# Run stat against /dev/null and check if it has any stdout output.
38
39
# If stdout is blank, we are detecting bsd-stat because stat it has
@@ -73,15 +74,13 @@ $(error Unsupported platform to compile for)
73
74
endif
74
75
75
76
GO_BUILD = env GOOS=$(PLATFORM ) GOARCH=$(ARCH ) go build -i $(GOFLAGS ) \
76
- -ldflags "-X $(SC_PKG ) /pkg.VERSION=$(VERSION ) "
77
+ -ldflags "-X $(SC_PKG ) /pkg.VERSION=$(VERSION ) $( BUILD_LDFLAGS ) "
77
78
BASE_PATH = $(ROOT:/src/github.com/kubernetes-incubator/service-catalog/= )
78
79
export GOPATH = $(BASE_PATH ) :$(ROOT ) /vendor
79
80
80
81
MUTABLE_TAG ?= canary
81
- APISERVER_IMAGE = $(REGISTRY ) apiserver-$(ARCH ) :$(VERSION )
82
- APISERVER_MUTABLE_IMAGE = $(REGISTRY ) apiserver-$(ARCH ) :$(MUTABLE_TAG )
83
- CONTROLLER_MANAGER_IMAGE = $(REGISTRY ) controller-manager-$(ARCH ) :$(VERSION )
84
- CONTROLLER_MANAGER_MUTABLE_IMAGE = $(REGISTRY ) controller-manager-$(ARCH ) :$(MUTABLE_TAG )
82
+ SERVICE_CATALOG_IMAGE = $(REGISTRY ) service-catalog-$(ARCH ) :$(VERSION )
83
+ SERVICE_CATALOG_MUTABLE_IMAGE = $(REGISTRY ) service-catalog-$(ARCH ) :$(MUTABLE_TAG )
85
84
USER_BROKER_IMAGE = $(REGISTRY ) user-broker-$(ARCH ) :$(VERSION )
86
85
USER_BROKER_MUTABLE_IMAGE = $(REGISTRY ) user-broker-$(ARCH ) :$(MUTABLE_TAG )
87
86
@@ -109,11 +108,10 @@ NON_VENDOR_DIRS = $(shell $(DOCKER_CMD) glide nv)
109
108
110
109
# This section builds the output binaries.
111
110
# Some will have dedicated targets to make it easier to type, for example
112
- # "apiserver " instead of "bin/apiserver ".
111
+ # "service-catalog " instead of "bin/service-catalog ".
113
112
# ########################################################################
114
113
build : .init .generate_files \
115
- $(BINDIR ) /apiserver \
116
- $(BINDIR ) /controller-manager \
114
+ $(BINDIR ) /service-catalog \
117
115
$(BINDIR ) /user-broker
118
116
119
117
user-broker : $(BINDIR ) /user-broker
@@ -122,14 +120,10 @@ $(BINDIR)/user-broker: .init contrib/cmd/user-broker \
122
120
$(shell find contrib/pkg/broker -type f)
123
121
$(DOCKER_CMD ) $(GO_BUILD ) -o $@ $(SC_PKG ) /contrib/cmd/user-broker
124
122
125
- # We'll rebuild apiserver if any go file has changed (ie. NEWEST_GO_FILE)
126
- apiserver : $(BINDIR ) /apiserver
127
- $(BINDIR ) /apiserver : .init .generate_files cmd/apiserver $(NEWEST_GO_FILE )
128
- $(DOCKER_CMD ) $(GO_BUILD ) -o $@ $(SC_PKG ) /cmd/apiserver
129
-
130
- controller-manager : $(BINDIR ) /controller-manager
131
- $(BINDIR ) /controller-manager : .init .generate_files cmd/controller-manager $(NEWEST_GO_FILE )
132
- $(DOCKER_CMD ) $(GO_BUILD ) -o $@ $(SC_PKG ) /cmd/controller-manager
123
+ # We'll rebuild service-catalog if any go file has changed (ie. NEWEST_GO_FILE)
124
+ service-catalog : $(BINDIR ) /service-catalog
125
+ $(BINDIR ) /service-catalog : .init .generate_files cmd/service-catalog $(NEWEST_GO_FILE )
126
+ $(DOCKER_CMD ) $(GO_BUILD ) -o $@ $(SC_PKG ) /cmd/service-catalog
133
127
134
128
# This section contains the code generation stuff
135
129
# ################################################
@@ -220,8 +214,9 @@ $(BINDIR)/e2e.test: .init $(NEWEST_E2ETEST_SOURCE) $(NEWEST_GO_FILE)
220
214
verify : .init .generate_files verify-client-gen
221
215
@echo Running gofmt:
222
216
@$(DOCKER_CMD ) gofmt -l -s $(TOP_TEST_DIRS ) $(TOP_SRC_DIRS ) > .out 2>&1 || true
223
- @bash -c ' [ "`cat .out`" == "" ] || \
224
- (echo -e " \n*** Please 'gofmt' the following:" ; cat .out ; echo ; false)'
217
+ @[ ! -s .out ] || \
218
+ (echo && echo " *** Please 'gofmt' the following:" && \
219
+ cat .out && echo && rm .out && false)
225
220
@rm .out
226
221
@#
227
222
@echo Running golint and go vet:
@@ -240,7 +235,7 @@ verify: .init .generate_files verify-client-gen
240
235
$(DOCKER_CMD ) go vet $(NON_VENDOR_DIRS )
241
236
@echo Running repo-infra verify scripts
242
237
@$(DOCKER_CMD ) vendor/github.com/kubernetes/repo-infra/verify/verify-boilerplate.sh --rootdir=. | grep -v generated > .out 2>&1 || true
243
- @bash -c ' [ "`cat .out`" == "" ] || (cat .out ; false)'
238
+ @[ ! -s .out ] || (cat .out && rm .out && false)
244
239
@rm .out
245
240
@#
246
241
@echo Running href checker:
@@ -328,7 +323,7 @@ clean-coverage:
328
323
329
324
# Building Docker Images for our executables
330
325
# ###########################################
331
- images : user-broker-image controller-manager-image apiserver -image
326
+ images : user-broker-image service-catalog -image
332
327
333
328
images-all : $(addprefix arch-image-,$(ALL_ARCH ) )
334
329
arch-image-% :
@@ -357,24 +352,17 @@ ifeq ($(ARCH),amd64)
357
352
docker tag $(USER_BROKER_MUTABLE_IMAGE) $(REGISTRY)user-broker:$(MUTABLE_TAG)
358
353
endif
359
354
360
- apiserver-image : build/apiserver/Dockerfile $(BINDIR ) /apiserver
361
- $(call build-and-tag,"apiserver",$(APISERVER_IMAGE ) ,$(APISERVER_MUTABLE_IMAGE ) )
362
- ifeq ($(ARCH ) ,amd64)
363
- docker tag $(APISERVER_IMAGE) $(REGISTRY)apiserver:$(VERSION)
364
- docker tag $(APISERVER_MUTABLE_IMAGE) $(REGISTRY)apiserver:$(MUTABLE_TAG)
365
- endif
366
-
367
- controller-manager-image : build/controller-manager/Dockerfile $(BINDIR ) /controller-manager
368
- $(call build-and-tag,"controller-manager",$(CONTROLLER_MANAGER_IMAGE ) ,$(CONTROLLER_MANAGER_MUTABLE_IMAGE ) )
355
+ service-catalog-image : build/service-catalog/Dockerfile $(BINDIR ) /service-catalog
356
+ $(call build-and-tag,"service-catalog",$(SERVICE_CATALOG_IMAGE ) ,$(SERVICE_CATALOG_MUTABLE_IMAGE ) )
369
357
ifeq ($(ARCH ) ,amd64)
370
- docker tag $(CONTROLLER_MANAGER_IMAGE ) $(REGISTRY)controller-manager :$(VERSION)
371
- docker tag $(CONTROLLER_MANAGER_MUTABLE_IMAGE ) $(REGISTRY)controller-manager :$(MUTABLE_TAG)
358
+ docker tag $(SERVICE_CATALOG_IMAGE ) $(REGISTRY)service-catalog :$(VERSION)
359
+ docker tag $(SERVICE_CATALOG_MUTABLE_IMAGE ) $(REGISTRY)service-catalog :$(MUTABLE_TAG)
372
360
endif
373
361
374
362
375
363
# Push our Docker Images to a registry
376
364
# #####################################
377
- push : user-broker-push controller-manager-push apiserver -push
365
+ push : user-broker-push service-catalog -push
378
366
379
367
user-broker-push : user-broker-image
380
368
docker push $(USER_BROKER_IMAGE )
@@ -384,20 +372,12 @@ ifeq ($(ARCH),amd64)
384
372
docker push $(REGISTRY)user-broker:$(MUTABLE_TAG)
385
373
endif
386
374
387
- controller-manager-push : controller-manager-image
388
- docker push $(CONTROLLER_MANAGER_IMAGE )
389
- docker push $(CONTROLLER_MANAGER_MUTABLE_IMAGE )
390
- ifeq ($(ARCH ) ,amd64)
391
- docker push $(REGISTRY)controller-manager:$(VERSION)
392
- docker push $(REGISTRY)controller-manager:$(MUTABLE_TAG)
393
- endif
394
-
395
- apiserver-push : apiserver-image
396
- docker push $(APISERVER_IMAGE )
397
- docker push $(APISERVER_MUTABLE_IMAGE )
375
+ service-catalog-push : service-catalog-image
376
+ docker push $(SERVICE_CATALOG_IMAGE )
377
+ docker push $(SERVICE_CATALOG_MUTABLE_IMAGE )
398
378
ifeq ($(ARCH ) ,amd64)
399
- docker push $(REGISTRY)apiserver :$(VERSION)
400
- docker push $(REGISTRY)apiserver :$(MUTABLE_TAG)
379
+ docker push $(REGISTRY)service-catalog :$(VERSION)
380
+ docker push $(REGISTRY)service-catalog :$(MUTABLE_TAG)
401
381
endif
402
382
403
383
0 commit comments