Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Mockery v1.1.1 #3015

Merged
merged 5 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 19 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ else
echo "Built without static files" > ui/dist/app/index.html
endif

$(HOME)/go/bin/staticfiles:
$(GOPATH)/bin/staticfiles:
# Install the "staticfiles" tool
go get bou.ke/staticfiles

server/static/files.go: $(HOME)/go/bin/staticfiles ui/dist/app/index.html
server/static/files.go: $(GOPATH)/bin/staticfiles ui/dist/app/index.html
# Pack UI into a Go file.
staticfiles -o server/static/files.go ui/dist/app

Expand All @@ -195,7 +195,7 @@ argo-server.key:
.PHONY: cli-image
cli-image: $(CLI_IMAGE_FILE)

$(CLI_IMAGE_FILE):
$(CLI_IMAGE_FILE): $(CLI_PKGS)
$(call docker_build,argocli,argo,$(CLI_IMAGE_FILE))

.PHONY: clis
Expand All @@ -217,7 +217,7 @@ dist/workflow-controller-%: $(CONTROLLER_PKGS)
.PHONY: controller-image
controller-image: $(CONTROLLER_IMAGE_FILE)

$(CONTROLLER_IMAGE_FILE):
$(CONTROLLER_IMAGE_FILE): $(CONTROLLER_PKGS)
$(call docker_build,workflow-controller,workflow-controller,$(CONTROLLER_IMAGE_FILE))

# argoexec
Expand All @@ -233,18 +233,21 @@ dist/argoexec-%: $(ARGOEXEC_PKGS)
executor-image: $(EXECUTOR_IMAGE_FILE)

# Create executor image
$(EXECUTOR_IMAGE_FILE):
$(EXECUTOR_IMAGE_FILE): $(ARGOEXEC_PKGS)
$(call docker_build,argoexec,argoexec,$(EXECUTOR_IMAGE_FILE))

# generation

$(HOME)/go/bin/mockery:
$(call backup_go_mod)
go get github.com/vektra/mockery/.../
$(call restore_go_mod)
$(GOPATH)/bin/mockery:
./hack/recurl.sh dist/mockery.tar.gz https://github.com/vektra/mockery/releases/download/v1.1.1/mockery_1.1.1_$(shell uname -s)_$(shell uname -m).tar.gz
tar zxvf dist/mockery.tar.gz mockery
chmod +x mockery
mkdir -p $(GOPATH)/bin
mv mockery $(GOPATH)/bin/mockery
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Manually overwriting binaries in go/bin might break some existing users' flow with go get. The download is 2 MB... perhaps we should keep in in the dist folder?

  2. What happens if the file already exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the file already exists, nothing happens, we want to install it permanently, we could go back to go get?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason to install permanently = reliability + speed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the file already exists, nothing happens

This is good enough, then. IMO

mockery -version

.PHONY: mocks
mocks: $(HOME)/go/bin/mockery
mocks: $(GOPATH)/bin/mockery
./hack/update-mocks.sh $(MOCK_FILES)

.PHONY: codegen
Expand Down Expand Up @@ -277,11 +280,11 @@ manifests:

# lint/test/etc

$(HOME)/go/bin/golangci-lint:
$(GOPATH)/bin/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.23.8

.PHONY: lint
lint: server/static/files.go $(HOME)/go/bin/golangci-lint
lint: server/static/files.go $(GOPATH)/bin/golangci-lint
# Tidy Go modules
go mod tidy
# Lint Go files
Expand All @@ -300,13 +303,13 @@ test: server/static/files.go
test-results/test-report.json: test-results/test.out
cat test-results/test.out | go tool test2json > test-results/test-report.json

$(HOME)/go/bin/go-junit-report:
$(GOPATH)/bin/go-junit-report:
$(call backup_go_mod)
go get github.com/jstemmer/go-junit-report
$(call restore_go_mod)

# note that we do not have a dependency on test.out, we assume you did correctly create this
test-results/junit.xml: $(HOME)/go/bin/go-junit-report test-results/test.out
test-results/junit.xml: $(GOPATH)/bin/go-junit-report test-results/test.out
cat test-results/test.out | go-junit-report > test-results/junit.xml

$(VERSION_FILE):
Expand Down Expand Up @@ -460,7 +463,7 @@ clean:

# swagger

$(HOME)/go/bin/swagger:
$(GOPATH)/bin/swagger:
$(call backup_go_mod)
go get github.com/go-swagger/go-swagger/cmd/swagger@v0.23.0
$(call restore_go_mod)
Expand All @@ -481,7 +484,7 @@ pkg/apis/workflow/v1alpha1/openapi_generated.go:
pkg/apiclient/_.secondary.swagger.json: hack/secondaryswaggergen.go pkg/apis/workflow/v1alpha1/openapi_generated.go dist/kubernetes.swagger.json
go run ./hack secondaryswaggergen

dist/swagger.json: $(HOME)/go/bin/swagger $(SWAGGER_FILES) $(MANIFESTS_VERSION_FILE) hack/swaggify.sh
dist/swagger.json: $(GOPATH)/bin/swagger $(SWAGGER_FILES) $(MANIFESTS_VERSION_FILE) hack/swaggify.sh
swagger mixin -c 680 $(SWAGGER_FILES) | sed 's/VERSION/$(MANIFESTS_VERSION)/' | ./hack/swaggify.sh > dist/swagger.json

dist/kubernetes.swagger.json:
Expand Down
2 changes: 1 addition & 1 deletion hack/recurl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ file=$1
url=$2

# loop forever
while ! curl -c -L -o "$file" -LO -- "$url" ;do
while ! curl -L -o "$file" -- "$url" ;do
echo "sleeping before trying again"
sleep 10s
done
Expand Down
2 changes: 1 addition & 1 deletion persist/sqldb/mocks/OffloadNodeStatusRepo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion persist/sqldb/mocks/WorkflowArchive.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion workflow/executor/mocks/ContainerRuntimeExecutor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.