Skip to content

Commit 5e60dec

Browse files
authored
feat(crds)!: Adds CRD generation and enhanced UI resource editor. Closes argoproj#859 (argoproj#3075)
1 parent c2347f3 commit 5e60dec

File tree

99 files changed

+44065
-1555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+44065
-1555
lines changed

.github/workflows/ci-build.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
tests:
1414
name: Tests
1515
runs-on: ubuntu-latest
16+
timeout-minutes: 15
1617
strategy:
1718
fail-fast: false
1819
matrix:
@@ -72,7 +73,8 @@ jobs:
7273
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
7374
echo '127.0.0.1 mysql' | sudo tee -a /etc/hosts
7475
mkdir dist
75-
KUBECONFIG=~/.kube/config make start PROFILE=$PROFILE E2E_EXECUTOR=docker DEV_IMAGE=true &
76+
mkdir -p /tmp/log/argo-e2e
77+
KUBECONFIG=~/.kube/config make start PROFILE=$PROFILE E2E_EXECUTOR=docker DEV_IMAGE=true > /tmp/log/argo-e2e/argo.log &
7678
- name: Wait for Argo Server to be ready
7779
if: ${{ matrix.test != 'test' }}
7880
env:
@@ -100,6 +102,7 @@ jobs:
100102
codegen:
101103
name: Codegen
102104
runs-on: ubuntu-latest
105+
timeout-minutes: 10
103106
steps:
104107
- name: Checkout code
105108
uses: actions/checkout@v2
@@ -160,6 +163,7 @@ jobs:
160163
ui:
161164
name: UI
162165
runs-on: ubuntu-latest
166+
timeout-minutes: 5
163167
steps:
164168
- name: Checkout code
165169
uses: actions/checkout@v2

Makefile

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,6 @@ SWAGGER_FILES := pkg/apiclient/_.primary.swagger.json \
130130
MOCK_FILES := $(shell find persist server workflow -maxdepth 4 -not -path '/vendor/*' -not -path './ui/*' -path '*/mocks/*' -type f -name '*.go')
131131
UI_FILES := $(shell find ui/src -type f && find ui -maxdepth 1 -type f)
132132

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
142133
# docker_build,image_name,binary_name,marker_file_name
143134
define docker_build
144135
# If we're making a dev build, we build this locally (this will be faster due to existing Go build caches).
@@ -187,9 +178,7 @@ else
187178
endif
188179

189180
$(GOPATH)/bin/staticfiles:
190-
$(call backup_go_mod)
191181
go get bou.ke/staticfiles
192-
$(call restore_go_mod)
193182

194183
server/static/files.go: $(GOPATH)/bin/staticfiles ui/dist/app/index.html
195184
# Pack UI into a Go file.
@@ -272,26 +261,50 @@ mocks: $(GOPATH)/bin/mockery
272261
./hack/update-mocks.sh $(MOCK_FILES)
273262

274263
.PHONY: codegen
275-
codegen: status proto swagger mocks docs
264+
codegen: status proto swagger manifests mocks docs
276265

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:
281273
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
283298
./hack/generate-proto.sh
284-
# Updated codegen
285299
./hack/update-codegen.sh
286-
$(call restore_go_mod)
287300

288301
# we use a different file to ./VERSION to force updating manifests after a `make clean`
289302
$(MANIFESTS_VERSION_FILE):
290303
@mkdir -p dist
291304
touch $(MANIFESTS_VERSION_FILE)
292305

293306
.PHONY: manifests
294-
manifests:
307+
manifests: crds
295308
./hack/update-image-tags.sh manifests/base $(MANIFESTS_VERSION)
296309
kustomize build --load_restrictor=none manifests/cluster-install | ./hack/auto-gen-msg.sh > manifests/install.yaml
297310
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
325338
cat test-results/test.out | go tool test2json > test-results/test-report.json
326339

327340
$(GOPATH)/bin/go-junit-report:
328-
$(call backup_go_mod)
329341
go get github.com/jstemmer/go-junit-report
330-
$(call restore_go_mod)
331342

332343
# note that we do not have a dependency on test.out, we assume you did correctly create this
333344
test-results/junit.xml: $(GOPATH)/bin/go-junit-report test-results/test.out
@@ -391,32 +402,13 @@ endif
391402
grep '127.0.0.1 *mysql' /etc/hosts
392403
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
393404

394-
395405
.PHONY: wait
396406
wait:
397407
# Wait for workflow controller
398408
until lsof -i :9090 > /dev/null ; do sleep 10s ; done
399409
# Wait for Argo Server
400410
until lsof -i :2746 > /dev/null ; do sleep 10s ; done
401411

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
420412

421413
.PHONY: postgres-cli
422414
postgres-cli:
@@ -449,29 +441,22 @@ smoke: test-images
449441
.PHONY: clean
450442
clean:
451443
# Delete build files
452-
rm -Rf dist/* ui/dist
444+
rm -Rf vendor dist/* ui/dist
453445

454446
# swagger
455447

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-
461448
.PHONY: swagger
462449
swagger: api/openapi-spec/swagger.json
463450

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)
467452
openapi-gen \
468453
--go-header-file ./hack/custom-boilerplate.go.txt \
469454
--input-dirs github.com/argoproj/argo/pkg/apis/workflow/v1alpha1 \
470455
--output-package github.com/argoproj/argo/pkg/apis/workflow/v1alpha1 \
471456
--report-filename pkg/apis/api-rules/violation_exceptions.list
472-
$(call restore_go_mod)
473457

474458
dist/kubernetes.swagger.json:
459+
@mkdir -p dist
475460
./hack/recurl.sh dist/kubernetes.swagger.json https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.15/api/openapi-spec/swagger.json
476461

477462
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.swagger.json: proto
@@ -512,7 +497,7 @@ docs: swagger
512497
# pre-push
513498

514499
.PHONY: pre-commit
515-
pre-commit: test lint codegen start
500+
pre-commit: codegen lint test start
516501

517502
# release - targets only available on release branch
518503
ifneq ($(findstring release,$(GIT_BRANCH)),)

0 commit comments

Comments
 (0)