@@ -130,15 +130,6 @@ SWAGGER_FILES := pkg/apiclient/_.primary.swagger.json \
130
130
MOCK_FILES := $(shell find persist server workflow -maxdepth 4 -not -path '/vendor/* ' -not -path './ui/* ' -path '* /mocks/* ' -type f -name '* .go')
131
131
UI_FILES := $(shell find ui/src -type f && find ui -maxdepth 1 -type f)
132
132
133
- define backup_go_mod
134
- # Back-up go.*, but only if we have not already done this (because that would suggest we failed mid-codegen and the currenty go.* files are borked).
135
- @mkdir -p dist
136
- [ -e dist/go.mod ] || cp go.mod go.sum dist/
137
- endef
138
- define restore_go_mod
139
- # Restore the back-ups.
140
- mv dist/go.mod dist/go.sum .
141
- endef
142
133
# docker_build,image_name,binary_name,marker_file_name
143
134
define docker_build
144
135
# If we're making a dev build, we build this locally (this will be faster due to existing Go build caches).
187
178
endif
188
179
189
180
$(GOPATH ) /bin/staticfiles :
190
- $(call backup_go_mod)
191
181
go get bou.ke/staticfiles
192
- $(call restore_go_mod)
193
182
194
183
server/static/files.go : $(GOPATH ) /bin/staticfiles ui/dist/app/index.html
195
184
# Pack UI into a Go file.
@@ -272,26 +261,50 @@ mocks: $(GOPATH)/bin/mockery
272
261
./hack/update-mocks.sh $(MOCK_FILES )
273
262
274
263
.PHONY : codegen
275
- codegen : status proto swagger mocks docs
264
+ codegen : status proto swagger manifests mocks docs
276
265
277
- .PHONY : proto
278
- proto :
279
- $(call backup_go_mod)
280
- # We need the folder for compatibility
266
+ .PHONY : crds
267
+ crds : $(GOPATH ) /bin/controller-gen
268
+ ./hack/crdgen.sh
269
+
270
+ # you cannot install a specific version using `go install`, so we do this business
271
+ .PHONY : tools
272
+ tools :
281
273
go mod vendor
282
- # Generate proto
274
+ go install ./vendor/github.com/go-swagger/go-swagger/cmd/swagger
275
+ go install ./vendor/github.com/gogo/protobuf/protoc-gen-gogo
276
+ go install ./vendor/github.com/gogo/protobuf/protoc-gen-gogofast
277
+ go install ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
278
+ go install ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
279
+ go install ./vendor/k8s.io/code-generator/cmd/go-to-protobuf
280
+ go install ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
281
+ go install ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen
282
+ rm -Rf vendor
283
+
284
+ $(GOPATH ) /bin/controller-gen : tools
285
+ $(GOPATH ) /bin/go-to-protobuf : tools
286
+ $(GOPATH ) /bin/protoc-gen-gogo : tools
287
+ $(GOPATH ) /bin/protoc-gen-gogofast : tools
288
+ $(GOPATH ) /bin/protoc-gen-grpc-gateway : tools
289
+ $(GOPATH ) /bin/protoc-gen-swagger : tools
290
+ $(GOPATH ) /bin/openapi-gen : tools
291
+ $(GOPATH ) /bin/swagger : tools
292
+
293
+ $(GOPATH ) /bin/goimports :
294
+ go get golang.org/x/tools/cmd/goimports
295
+
296
+ .PHONY : proto
297
+ proto : $(GOPATH ) /bin/go-to-protobuf $(GOPATH ) /bin/protoc-gen-gogo $(GOPATH ) /bin/protoc-gen-gogofast $(GOPATH ) /bin/goimports $(GOPATH ) /bin/protoc-gen-grpc-gateway $(GOPATH ) /bin/protoc-gen-swagger
283
298
./hack/generate-proto.sh
284
- # Updated codegen
285
299
./hack/update-codegen.sh
286
- $(call restore_go_mod)
287
300
288
301
# we use a different file to ./VERSION to force updating manifests after a `make clean`
289
302
$(MANIFESTS_VERSION_FILE ) :
290
303
@mkdir -p dist
291
304
touch $(MANIFESTS_VERSION_FILE )
292
305
293
306
.PHONY : manifests
294
- manifests :
307
+ manifests : crds
295
308
./hack/update-image-tags.sh manifests/base $(MANIFESTS_VERSION )
296
309
kustomize build --load_restrictor=none manifests/cluster-install | ./hack/auto-gen-msg.sh > manifests/install.yaml
297
310
kustomize build --load_restrictor=none manifests/namespace-install | ./hack/auto-gen-msg.sh > manifests/namespace-install.yaml
@@ -325,9 +338,7 @@ test-results/test-report.json: test-results/test.out
325
338
cat test-results/test.out | go tool test2json > test-results/test-report.json
326
339
327
340
$(GOPATH ) /bin/go-junit-report :
328
- $(call backup_go_mod)
329
341
go get github.com/jstemmer/go-junit-report
330
- $(call restore_go_mod)
331
342
332
343
# note that we do not have a dependency on test.out, we assume you did correctly create this
333
344
test-results/junit.xml : $(GOPATH ) /bin/go-junit-report test-results/test.out
@@ -391,32 +402,13 @@ endif
391
402
grep '127.0.0.1 *mysql' /etc/hosts
392
403
env SECURE=$(SECURE) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) LOG_LEVEL=$(LOG_LEVEL) VERSION=$(VERSION) AUTH_MODE=$(AUTH_MODE) $(GOPATH)/bin/goreman -set-ports=false -logtime=false start
393
404
394
-
395
405
.PHONY : wait
396
406
wait :
397
407
# Wait for workflow controller
398
408
until lsof -i :9090 > /dev/null ; do sleep 10s ; done
399
409
# Wait for Argo Server
400
410
until lsof -i :2746 > /dev/null ; do sleep 10s ; done
401
411
402
- define print_env
403
- export ARGO_SERVER=localhost:2746
404
- export ARGO_SECURE=true
405
- export ARGO_INSECURE_SKIP_VERIFY=true
406
- export ARGO_TOKEN=$(shell ./dist/argo auth token)
407
- endef
408
-
409
- # this is a convenience to get the login token, you can use it as follows
410
- # eval $(make env)
411
- # argo token
412
- .PHONY : env
413
- env :
414
- $(call print_env)
415
-
416
- .PHONY : logs
417
- logs :
418
- # Tail logs
419
- kubectl -n $(KUBE_NAMESPACE ) logs -f -l app --max-log-requests 10 --tail 100
420
412
421
413
.PHONY : postgres-cli
422
414
postgres-cli :
@@ -449,29 +441,22 @@ smoke: test-images
449
441
.PHONY : clean
450
442
clean :
451
443
# Delete build files
452
- rm -Rf dist/* ui/dist
444
+ rm -Rf vendor dist/* ui/dist
453
445
454
446
# swagger
455
447
456
- $(GOPATH ) /bin/swagger :
457
- $(call backup_go_mod)
458
- go get github.com/go-swagger/go-swagger/cmd/
[email protected]
459
- $(call restore_go_mod)
460
-
461
448
.PHONY : swagger
462
449
swagger : api/openapi-spec/swagger.json
463
450
464
- pkg/apis/workflow/v1alpha1/openapi_generated.go : $(shell find pkg/apis/workflow/v1alpha1 -type f -not -name openapi_generated.go)
465
- $(call backup_go_mod)
466
- go install k8s.io/kube-openapi/cmd/openapi-gen
451
+ pkg/apis/workflow/v1alpha1/openapi_generated.go : $(GOPATH ) /bin/openapi-gen $(shell find pkg/apis/workflow/v1alpha1 -type f -not -name openapi_generated.go)
467
452
openapi-gen \
468
453
--go-header-file ./hack/custom-boilerplate.go.txt \
469
454
--input-dirs github.com/argoproj/argo/pkg/apis/workflow/v1alpha1 \
470
455
--output-package github.com/argoproj/argo/pkg/apis/workflow/v1alpha1 \
471
456
--report-filename pkg/apis/api-rules/violation_exceptions.list
472
- $(call restore_go_mod)
473
457
474
458
dist/kubernetes.swagger.json :
459
+ @mkdir -p dist
475
460
./hack/recurl.sh dist/kubernetes.swagger.json https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.15/api/openapi-spec/swagger.json
476
461
477
462
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.swagger.json : proto
@@ -512,7 +497,7 @@ docs: swagger
512
497
# pre-push
513
498
514
499
.PHONY : pre-commit
515
- pre-commit : test lint codegen start
500
+ pre-commit : codegen lint test start
516
501
517
502
# release - targets only available on release branch
518
503
ifneq ($(findstring release,$(GIT_BRANCH ) ) ,)
0 commit comments