From 9a0980b5c52867d63f34d2537270c28265db3cfe Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Tue, 2 Jun 2020 11:10:01 +0200 Subject: [PATCH 01/12] fix(plugin): make publish Signed-off-by: Yvonnick Esnault --- contrib/grpcplugins/action/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/contrib/grpcplugins/action/Makefile b/contrib/grpcplugins/action/Makefile index 25c0d0c582..b12a688c68 100644 --- a/contrib/grpcplugins/action/Makefile +++ b/contrib/grpcplugins/action/Makefile @@ -68,6 +68,9 @@ manifestbuild: echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ + EXTENSION=""; \ + if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ + FILENAME=plugin-$$PACKAGE-$$GOOS-$$GOARCH$$EXTENSION; \ perl -pi -e s,%filename%,$$FILENAME,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ pluginname=$$PACKAGE; \ cp $$PACKAGE/$$pluginname.yml $(TARGET_DIR)/plugin-$$PACKAGE.yml; \ @@ -81,25 +84,27 @@ publish-all: @echo "Updating plugins..." @for plugin in $(DIRS); do \ pluginname=$(basename "$$plugin"); \ - cdsctl admin plugins import $$plugin/$(TARGET_DIR)/plugin.yml; \ + if test "$$pluginname" = "examples" ; then continue; fi; \ + if test "$$pluginname" = "dist" ; then continue; fi; \ + cdsctl admin plugins import $(TARGET_DIR)/plugin-$$plugin.yml; \ for GOOS in $(TARGET_OS); do \ for GOARCH in $(TARGET_ARCH); do \ EXTENSION=""; \ if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ echo "Updating plugin binary $$pluginname-$$GOOS-$$GOARCH$$EXTENSION"; \ - cdsctl admin plugins binary-add plugin-$$pluginname $$plugin/$(TARGET_DIR)/plugin-$$GOOS-$$GOARCH.yml $$plugin/$(TARGET_DIR)/$$pluginname-$$GOOS-$$GOARCH$$EXTENSION; \ + cdsctl admin plugins binary-add plugin-$$pluginname $(TARGET_DIR)/plugin-$$pluginname-$$GOOS-$$GOARCH.yml $(TARGET_DIR)/plugin-$$pluginname-$$GOOS-$$GOARCH$$EXTENSION; \ done; \ done; \ done; publish: @echo "Updating plugin $(TARGET_NAME)..." - cdsctl admin plugins import $(TARGET_NAME)/$(TARGET_DIR)/plugin.yml + cdsctl admin plugins import $(TARGET_DIR)/plugin-$(TARGET_NAME).yml @for GOOS in $(TARGET_OS); do \ for GOARCH in $(TARGET_ARCH); do \ EXTENSION=""; \ if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ echo "Updating plugin binary $(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION"; \ - cdsctl admin plugins binary-add plugin-$(TARGET_NAME) $(TARGET_NAME)/$(TARGET_DIR)/plugin-$$GOOS-$$GOARCH.yml $(TARGET_NAME)/$(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ + cdsctl admin plugins binary-add plugin-$(TARGET_NAME) $(TARGET_DIR)/plugin-$(TARGET_NAME)-$$GOOS-$$GOARCH.yml $(TARGET_DIR)/plugin-$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ done; \ done From a8421d498a0aef662dbc477c0a65f4eed00ebce2 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Wed, 3 Jun 2020 19:11:11 +0200 Subject: [PATCH 02/12] chore(plugins): makefile Signed-off-by: Yvonnick Esnault --- .build/core.mk | 16 ++ .build/go.mk | 198 ++++++++++++++++++ .build/plugin.mk | 57 +++++ contrib/grpcplugins/action/Makefile | 127 +++-------- .../{archive => plugin-archive}/.gitignore | 0 .../action/plugin-archive/Makefile | 9 + .../action/{archive => plugin-archive}/go.mod | 0 .../action/{archive => plugin-archive}/go.sum | 1 + .../{archive => plugin-archive}/main.go | 0 .../plugin-archive.yml} | 0 .../plugin_test.go | 0 .../action/{clair => plugin-clair}/.gitignore | 0 .../grpcplugins/action/plugin-clair/Makefile | 9 + .../{clair => plugin-clair}/clairctl/LICENSE | 0 .../clairctl/clair/analyze.go | 0 .../clairctl/clair/clair.go | 0 .../clairctl/clair/layering.go | 0 .../clairctl/clair/push.go | 0 .../clairctl/config/config.go | 0 .../clairctl/docker/docker.go | 0 .../clairctl/docker/dockercli/dockercli.go | 0 .../clairctl/docker/dockerdist/auth.go | 0 .../clairctl/docker/dockerdist/dockerdist.go | 0 .../clairctl/xstrings/xstrings.go | 0 .../action/{clair => plugin-clair}/go.mod | 0 .../action/{clair => plugin-clair}/go.sum | 1 + .../action/{clair => plugin-clair}/main.go | 0 .../plugin-clair.yml} | 0 .../{download => plugin-download}/.gitignore | 0 .../action/plugin-download/Makefile | 9 + .../{download => plugin-download}/go.mod | 0 .../{download => plugin-download}/go.sum | 0 .../{download => plugin-download}/main.go | 0 .../plugin-download.yml} | 0 .../plugin_test.go | 0 .../.gitignore | 0 .../action/plugin-group-tmpl/Makefile | 9 + .../applications.go | 0 .../applications_test.go | 0 .../{group-tmpl => plugin-group-tmpl}/go.mod | 0 .../{group-tmpl => plugin-group-tmpl}/go.sum | 0 .../{group-tmpl => plugin-group-tmpl}/main.go | 0 .../plugin-group-tmpl.yml} | 0 .../plugin_test.go | 0 .../templates.go | 0 .../.gitignore | 0 .../action/plugin-kafka-publish/Makefile | 9 + .../README.md | 0 .../cli.go | 0 .../cli_actions.go | 0 .../go.mod | 0 .../go.sum | 0 .../kafka.go | 0 .../kafka_ack.go | 0 .../kafka_consumer.go | 0 .../kafkapublisher/chunks.go | 0 .../kafkapublisher/chunks_test.go | 0 .../kafkapublisher/context.go | 0 .../kafkapublisher/types.go | 0 .../log.go | 0 .../main.go | 0 .../plugin-kafka-publish.yml} | 0 .../plugin_test.go | 0 .../{marathon => plugin-marathon}/.gitignore | 0 .../action/plugin-marathon/Makefile | 9 + .../{marathon => plugin-marathon}/README.md | 0 .../fixtures/marathon1.json | 0 .../fixtures/marathon2.json | 0 .../fixtures/marathon3.json | 0 .../fixtures/marathon4.json | 0 .../fixtures/marathon5.json | 0 .../fixtures/marathon6.json | 0 .../{marathon => plugin-marathon}/go.mod | 0 .../{marathon => plugin-marathon}/go.sum | 0 .../{marathon => plugin-marathon}/main.go | 0 .../marathon_schema.go | 0 .../plugin-marathon.yml} | 0 .../plugin_test.go | 0 .../.gitignore | 0 .../action/plugin-npm-audit-parser/Makefile | 9 + .../go.mod | 0 .../go.sum | 0 .../main.go | 0 .../plugin-npm-audit-parser.yml} | 0 .../types.go | 0 .../{ssh-cmd => plugin-ssh-cmd}/.gitignore | 0 .../action/plugin-ssh-cmd/Makefile | 9 + .../action/{ssh-cmd => plugin-ssh-cmd}/go.mod | 0 .../action/{ssh-cmd => plugin-ssh-cmd}/go.sum | 0 .../{ssh-cmd => plugin-ssh-cmd}/main.go | 0 .../plugin-ssh-cmd.yml} | 0 .../action/{tmpl => plugin-tmpl}/.gitignore | 0 .../grpcplugins/action/plugin-tmpl/Makefile | 9 + .../action/{tmpl => plugin-tmpl}/go.mod | 0 .../action/{tmpl => plugin-tmpl}/go.sum | 0 .../action/{tmpl => plugin-tmpl}/main.go | 0 .../tmpl.yml => plugin-tmpl/plugin-tmpl.yml} | 0 .../{tmpl => plugin-tmpl}/plugin_test.go | 0 .../action/{venom => plugin-venom}/.gitignore | 0 .../grpcplugins/action/plugin-venom/Makefile | 9 + .../action/{venom => plugin-venom}/go.mod | 0 .../action/{venom => plugin-venom}/go.sum | 0 .../action/{venom => plugin-venom}/main.go | 0 .../plugin-venom.yml} | 0 .../{venom => plugin-venom}/tests/file1.yml | 0 .../{venom => plugin-venom}/tests/file2.yml | 0 .../tests/subtest/file3.yml | 0 .../{venom => plugin-venom}/venom_test.go | 0 108 files changed, 392 insertions(+), 98 deletions(-) create mode 100644 .build/core.mk create mode 100644 .build/go.mk create mode 100644 .build/plugin.mk rename contrib/grpcplugins/action/{archive => plugin-archive}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-archive/Makefile rename contrib/grpcplugins/action/{archive => plugin-archive}/go.mod (100%) rename contrib/grpcplugins/action/{archive => plugin-archive}/go.sum (99%) rename contrib/grpcplugins/action/{archive => plugin-archive}/main.go (100%) rename contrib/grpcplugins/action/{archive/archive.yml => plugin-archive/plugin-archive.yml} (100%) rename contrib/grpcplugins/action/{archive => plugin-archive}/plugin_test.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-clair/Makefile rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/LICENSE (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/clair/analyze.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/clair/clair.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/clair/layering.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/clair/push.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/config/config.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/docker/docker.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/docker/dockercli/dockercli.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/docker/dockerdist/auth.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/docker/dockerdist/dockerdist.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/clairctl/xstrings/xstrings.go (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/go.mod (100%) rename contrib/grpcplugins/action/{clair => plugin-clair}/go.sum (99%) rename contrib/grpcplugins/action/{clair => plugin-clair}/main.go (100%) rename contrib/grpcplugins/action/{clair/clair.yml => plugin-clair/plugin-clair.yml} (100%) rename contrib/grpcplugins/action/{download => plugin-download}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-download/Makefile rename contrib/grpcplugins/action/{download => plugin-download}/go.mod (100%) rename contrib/grpcplugins/action/{download => plugin-download}/go.sum (100%) rename contrib/grpcplugins/action/{download => plugin-download}/main.go (100%) rename contrib/grpcplugins/action/{download/download.yml => plugin-download/plugin-download.yml} (100%) rename contrib/grpcplugins/action/{download => plugin-download}/plugin_test.go (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-group-tmpl/Makefile rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/applications.go (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/applications_test.go (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/go.mod (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/go.sum (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/main.go (100%) rename contrib/grpcplugins/action/{group-tmpl/group-tmpl.yml => plugin-group-tmpl/plugin-group-tmpl.yml} (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/plugin_test.go (100%) rename contrib/grpcplugins/action/{group-tmpl => plugin-group-tmpl}/templates.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-kafka-publish/Makefile rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/README.md (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/cli.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/cli_actions.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/go.mod (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/go.sum (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafka.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafka_ack.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafka_consumer.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafkapublisher/chunks.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafkapublisher/chunks_test.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafkapublisher/context.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/kafkapublisher/types.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/log.go (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/main.go (100%) rename contrib/grpcplugins/action/{kafka-publish/kafka-publish.yml => plugin-kafka-publish/plugin-kafka-publish.yml} (100%) rename contrib/grpcplugins/action/{kafka-publish => plugin-kafka-publish}/plugin_test.go (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-marathon/Makefile rename contrib/grpcplugins/action/{marathon => plugin-marathon}/README.md (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon1.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon2.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon3.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon4.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon5.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/fixtures/marathon6.json (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/go.mod (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/go.sum (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/main.go (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/marathon_schema.go (100%) rename contrib/grpcplugins/action/{marathon/marathon.yml => plugin-marathon/plugin-marathon.yml} (100%) rename contrib/grpcplugins/action/{marathon => plugin-marathon}/plugin_test.go (100%) rename contrib/grpcplugins/action/{npm-audit-parser => plugin-npm-audit-parser}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile rename contrib/grpcplugins/action/{npm-audit-parser => plugin-npm-audit-parser}/go.mod (100%) rename contrib/grpcplugins/action/{npm-audit-parser => plugin-npm-audit-parser}/go.sum (100%) rename contrib/grpcplugins/action/{npm-audit-parser => plugin-npm-audit-parser}/main.go (100%) rename contrib/grpcplugins/action/{npm-audit-parser/npm-audit-parser.yml => plugin-npm-audit-parser/plugin-npm-audit-parser.yml} (100%) rename contrib/grpcplugins/action/{npm-audit-parser => plugin-npm-audit-parser}/types.go (100%) rename contrib/grpcplugins/action/{ssh-cmd => plugin-ssh-cmd}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-ssh-cmd/Makefile rename contrib/grpcplugins/action/{ssh-cmd => plugin-ssh-cmd}/go.mod (100%) rename contrib/grpcplugins/action/{ssh-cmd => plugin-ssh-cmd}/go.sum (100%) rename contrib/grpcplugins/action/{ssh-cmd => plugin-ssh-cmd}/main.go (100%) rename contrib/grpcplugins/action/{ssh-cmd/ssh-cmd.yml => plugin-ssh-cmd/plugin-ssh-cmd.yml} (100%) rename contrib/grpcplugins/action/{tmpl => plugin-tmpl}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-tmpl/Makefile rename contrib/grpcplugins/action/{tmpl => plugin-tmpl}/go.mod (100%) rename contrib/grpcplugins/action/{tmpl => plugin-tmpl}/go.sum (100%) rename contrib/grpcplugins/action/{tmpl => plugin-tmpl}/main.go (100%) rename contrib/grpcplugins/action/{tmpl/tmpl.yml => plugin-tmpl/plugin-tmpl.yml} (100%) rename contrib/grpcplugins/action/{tmpl => plugin-tmpl}/plugin_test.go (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/.gitignore (100%) create mode 100644 contrib/grpcplugins/action/plugin-venom/Makefile rename contrib/grpcplugins/action/{venom => plugin-venom}/go.mod (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/go.sum (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/main.go (100%) rename contrib/grpcplugins/action/{venom/venom.yml => plugin-venom/plugin-venom.yml} (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/tests/file1.yml (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/tests/file2.yml (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/tests/subtest/file3.yml (100%) rename contrib/grpcplugins/action/{venom => plugin-venom}/venom_test.go (100%) diff --git a/.build/core.mk b/.build/core.mk new file mode 100644 index 0000000000..4f935e131a --- /dev/null +++ b/.build/core.mk @@ -0,0 +1,16 @@ +CI := $(if ${CI},${CI},0) +VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot) +CDS_VERSION := $(if ${CDS_VERSION},${CDS_VERSION},snapshot) +GITHASH := $(if ${GIT_HASH},${GIT_HASH},`git log -1 --format="%H"`) +BUILDTIME := `date "+%m/%d/%y-%H:%M:%S"` +UNAME := $(shell uname) +UNAME_LOWERCASE := $(shell uname -s| tr A-Z a-z) + +.PHONY: help +help: + @grep -hE '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}' + +install-venom: ## install venom, usage: make venom-install venom_version=v0.27.0 venom_path=/usr/bin/ + @curl https://github.com/ovh/venom/releases/download/$(venom_version)/venom.$(UNAME_LOWERCASE)-amd64 -L -o $(venom_path)/venom && \ + chmod +x $(venom_path)/venom diff --git a/.build/go.mk b/.build/go.mk new file mode 100644 index 0000000000..994499af30 --- /dev/null +++ b/.build/go.mk @@ -0,0 +1,198 @@ +GO_BUILD = GOPRIVATE="${GO_PRIVATE}" CGO_ENABLED=0 go build -a -installsuffix cgo +GO_LIST = env GO111MODULE=on GOPRIVATE="${GO_PRIVATE}" go list +TEST_CMD = go test -v -timeout 600s -coverprofile=profile.coverprofile +TEST_C_CMD = go test -c -coverprofile=profile.coverprofile +TEST_RUN_ARGS = -test.v -test.timeout 600s -test.coverprofile=profile.coverprofile +LDFLAGS = -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION) -X github.com/ovh/cds/sdk.GOOS=$$GOOS -X github.com/ovh/cds/sdk.GOARCH=$$GOARCH -X github.com/ovh/cds/sdk.GITHASH=$(GITHASH) -X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME) -X github.com/ovh/cds/sdk.BINARY=$(TARGET_ENGINE) -X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)" +CURRENT_PACKAGE = $(shell $(GO_LIST)) +TARGET_DIST := ./dist +TARGET_RESULTS := ./results +ENABLE_CROSS_COMPILATION := true + + +##### =====> Clean <===== ##### + +mk_go_clean: # clean target directory + @rm -rf $(TARGET_DIST) + @rm -rf $(TARGET_RESULTS) + @for testfile in `find ./ -name "bin.test"`; do \ + rm $$testfile; \ + done; + @for TST in `find ./ -name "tests.log"`; do \ + rm $$TST; \ + done; + @for profile in `find ./ -name "*.coverprofile"`; do \ + rm $$profile; \ + done; + +##### =====> Compile <===== ##### + +IS_TEST := $(filter test,$(MAKECMDGOALS)) +TARGET_OS := $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), darwin linux freebsd)),$(shell go env GOOS)) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64)) +BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) +CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES))) +GOFILES = $(call get_recursive_files, '.') + +mk_go_build: + $(info *** mk_go_build) + +$(CROSS_COMPILED_BINARIES): $(GOFILES) $(TARGET_DIST) + $(info *** compiling $@) + @GOOS=$(call get_os_from_binary_file,$@) \ + GOARCH=$(call get_arch_from_binary_file,$@) \ + $(GO_BUILD) $(LDFLAGS) -o $@; + +##### =====> Compile Tests <===== ##### + +PKGS = $(or $(PKG),$(shell $(GO_LIST) ./...)) +TESTPKGS = $(shell $(GO_LIST) -f \ + '{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \ + $(PKGS)) + +TESTPKGS_C_FILE = $(addsuffix /bin.test, $(subst $(CURRENT_PACKAGE),.,$(PKG))) +TESTPKGS_C = $(foreach PKG, $(TESTPKGS), $(TESTPKGS_C_FILE)) + +$(TESTPKGS_C): #main_test.go + $(info *** compiling test $@) + @cd $(dir $@) && $(TEST_C_CMD) -o bin.test . + +##### =====> Running Tests <===== ##### + +TESTPKGS_RESULTS_LOG_FILE = $(addsuffix /tests.log, $(subst $(CURRENT_PACKAGE),.,$(PKG))) +TESTPKGS_RESULTS = $(foreach PKG, $(TESTPKGS), $(TESTPKGS_RESULTS_LOG_FILE)) + +$(HOME)/.richstyle.yml: + echo "leaveTestPrefix: true" > $(HOME)/.richstyle.yml + +GO_RICHGO = ${GOPATH}/bin/richgo +$(GO_RICHGO): $(HOME)/.richstyle.yml + go get -u github.com/kyoh86/richgo + +EXIT_TESTS := 0 +$(TESTPKGS_RESULTS): $(GOFILES) $(TESTPKGS_C) $(GO_RICHGO) + $(info *** executing tests in $(dir $@)) + @-cd $(dir $@) && ./bin.test $(TEST_RUN_ARGS) | tee tests.log | richgo testfilter ; + +GO_COV_MERGE = ${GOPATH}/bin/gocovmerge +$(GO_COV_MERGE): + go get -u github.com/wadey/gocovmerge + +GO_GOJUNIT = ${GOPATH}/bin/go-junit-report +$(GO_GOJUNIT): + go get -u github.com/jstemmer/go-junit-report + +GO_COBERTURA = ${GOPATH}/bin/gocover-cobertura +$(GO_COBERTURA): + go get -u github.com/t-yuki/gocover-cobertura + +mk_go_test: $(GO_COV_MERGE) $(GO_COBERTURA) $(GOFILES) $(TARGET_RESULTS) $(TESTPKGS_RESULTS)# Run tests + @echo "Generating unit tests coverage..." + @$(GO_COV_MERGE) `find ./ -name "*.coverprofile"` > $(TARGET_RESULTS)/cover.out + @$(GO_COBERTURA) < $(TARGET_RESULTS)/cover.out > $(TARGET_RESULTS)/coverage.xml + @go tool cover -html=$(TARGET_RESULTS)/cover.out -o=$(TARGET_RESULTS)/cover.html + @NB=$$(grep -c "^FAIL" `find . -type f -name "tests.log"`|grep -v ':0'|wc -l); echo "tests failed $$NB" && exit $$NB + +mk_go_test-xunit: $(GO_GOJUNIT) $(TARGET_RESULTS) # Generate test with xunit report + @echo "Generating xUnit Report..." + @for TST in `find . -name "tests.log"`; do \ + if [ -s $$TST ]; then \ + FAILED=`grep -E '(FAIL)+\s([a-z\.\/]*)\s\[build failed\]' $$TST | wc -l`; \ + if [ $$FAILED -gt 0 ]; then \ + echo "Build Failed \t\t\t($$TST)"; \ + echo "Build Failed \t\t\t($$TST)" >> $(TARGET_RESULTS)/fail; \ + else \ + NO_TESTS=`grep -E '\?+\s+([a-z\.\/]*)\s\[no test files\]' $$TST | wc -l`; \ + if [ $$NO_TESTS -gt 0 ]; then \ + echo "No tests found \t\t\t($$TST)"; \ + else \ + if [ ! -z "${CDS_VERSION}" ]; then \ + echo "Sending $$TST to CDS"; \ + worker upload --tag `echo $$TST | sed 's|./||' | sed 's|./||' | sed 's|/|_|g') | sed 's|_tests.log||'` $(abspath $$TST); \ + fi; \ + echo "Generating xUnit report \t$$TST.tests-results.xml"; \ + cat $$TST | $(GO_GOJUNIT) > $$TST.tests-results.xml; \ + fi; \ + fi; \ + else \ + echo "Ignoring empty file \t\t$$TST"; \ + fi; \ + done; \ + for XML in `find . -name "tests.log.tests-results.xml"`; do \ + if [ "$$XML" = "./tests.log.tests-results.xml" ]; then \ + PWD=`pwd`; \ + mv $$XML $(TARGET_RESULTS)/`basename $(PWD)`.tests-results.xml; \ + else \ + mv $$XML $(TARGET_RESULTS)/`echo $$XML | sed 's|./||' | sed 's|/|_|g' | sed 's|_tests.log||'`; \ + fi; \ + done; \ + rm -f $(TARGET_RESULTS)/report; \ + for XML in `find . -name "*.tests-results.xml"`; do \ + if [ -s $$XML ]; then \ + if grep -q 'testsuite' $$XML; then \ + echo "Generating report: " $$XML; \ + echo "`xmllint --xpath "//testsuite/@name" $$XML | sed 's/name=//' | sed 's/"//g'`" \ + "`xmllint --xpath "//testsuite/@tests" $$XML | sed 's/tests=//' | sed 's/"//g'` Tests :" \ + "`xmllint --xpath "//testsuite/@errors" $$XML 2>/dev/null | sed 's/errors=//' | sed 's/"//g'` Errors ;"\ + "`xmllint --xpath "//testsuite/@failures" $$XML 2>/dev/null | sed 's/failures=//' | sed 's/"//g'` Failures;" \ + "`xmllint --xpath "//testsuite/@skip" $$XML 2>/dev/null | sed 's/skip=//' | sed 's/"//g'` Skipped;" \ + >> $(TARGET_RESULTS)/report; \ + fi; \ + fi; \ + done; \ + if [ -e $(TARGET_RESULTS)/report ]; then \ + cat $(TARGET_RESULTS)/report; \ + fi; \ + echo "#########################"; \ + for XML in `find . -name "*.tests-results.xml"`; do \ + if [ -s $$XML ]; then \ + if grep -q 'errors' $$XML && grep -q 'testsuite' $$XML; then \ + if [ "`xmllint --xpath "//testsuite/@errors" $$XML | sed 's/errors=//' | sed 's/"//g'`" -gt "0" ]; then \ + echo " $$XML : Tests failed"; \ + fi; \ + fi; \ + if grep -q 'failures' $$XML && grep -q 'testsuite' $$XML $$XML; then \ + if [ "`xmllint --xpath "//testsuite/@failures" $$XML | sed 's/failures=//' | sed 's/"//g'`" -gt "0" ]; then \ + echo " $$XML : Tests failed"; \ + fi; \ + fi; \ + fi; \ + done; \ + if [ -e $(TARGET_RESULTS)/fail ]; then \ + echo "#########################"; \ + echo "ERROR: Test compilation failure"; \ + cat $(TARGET_RESULTS)/fail; \ + exit 1; \ + fi; + +##### =====> lint <===== ##### + +GOLANG_CI_LINT := ${GOPATH}/bin/golangci-lint +$(GOLANG_CI_LINT): + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0 + +mk_go_lint: $(GOLANG_CI_LINT) # run golangci lint + $(info *** running lint) + $(GOLANG_CI_LINT) run + +##### =====> Internals <===== ##### + +$(TARGET_RESULTS): + $(info create $(TARGET_RESULTS) directory) + @mkdir -p $(TARGET_RESULTS) + +$(TARGET_DIST): + $(info create $(TARGET_DIST) directory) + @mkdir -p $(TARGET_DIST) + +define get_os_from_binary_file +$(strip $(shell echo $(1) | cut -d'_' -f 2)) +endef + +define get_arch_from_binary_file +$(strip $(patsubst %.exe, %,$(shell echo $(1) | cut -d'_' -f 3))) +endef + +define get_recursive_files +$(subst ./,,$(shell find $(1) -type f -name "*.go" -print)) +endef diff --git a/.build/plugin.mk b/.build/plugin.mk new file mode 100644 index 0000000000..13f22b5874 --- /dev/null +++ b/.build/plugin.mk @@ -0,0 +1,57 @@ + +BINARIES_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH).yml, $(notdir $(TARGET_NAME)))) +PLUGIN_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix .yml, $(notdir $(TARGET_NAME)))) +CROSS_COMPILED_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES_CONF))) + +define PLUGIN_MANIFEST_BINARY +os: %os% +arch: %arch% +cmd: ./%filename% +endef +export PLUGIN_MANIFEST_BINARY + +define get_os_from_binary_file +$(strip $(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n-1]}')) +endef + +define get_arch_from_binary_file +$(strip $(patsubst %.exe, %,$(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n]}'))) +endef + +define get_executor_path_from_binary_file +$(strip $(patsubst dist/%, %, $(patsubst %-, %, $(shell echo $(1) |awk '{n=split($$1,a,"-");for (i = 2; i < n-1; i++) printf a[i] "-"}')))) +endef + +## Prepare yml file for each os-arch +$(CROSS_COMPILED_PLUGIN_CONF): $(GOFILES) $(TARGET_DIST) + $(info *** prepare conf $@) + @echo "$$PLUGIN_MANIFEST_BINARY" > $@; \ + OS=$(call get_os_from_binary_file,$@); \ + ARCH=$(call get_arch_from_binary_file,$@); \ + perl -pi -e s,%os%,$$OS,g $@ ; \ + perl -pi -e s,%arch%,$$ARCH,g $@ ; \ + EXTENSION=""; \ + if test "$(TARGET_NAME)" == *"windows"* ; then EXTENSION=".exe"; fi; \ + FILENAME=$(TARGET_NAME)-$$OS-$$ARCH$$EXTENSION; \ + perl -pi -e s,%filename%,$$FILENAME,g $@ + +$(PLUGIN_CONF): $(TARGET_DIST) + $(info *** prepare conf $@) + @cp $(TARGET_NAME).yml $@; + +publish: + @echo "Updating plugin $(TARGET_NAME)..." + cdsctl admin plugins import $(TARGET_DIST)/$(TARGET_NAME).yml + @for GOOS in $(TARGET_OS); do \ + for GOARCH in $(TARGET_ARCH); do \ + EXTENSION=""; \ + if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ + echo "Updating plugin binary $(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION"; \ + cdsctl admin plugins binary-add $(TARGET_NAME) $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ + done; \ + done + +build: $(CROSS_COMPILED_PLUGIN_CONF) $(PLUGIN_CONF) $(CROSS_COMPILED_BINARIES) ## build action plugin and prepare configuration + +clean: + @rm -rf dist diff --git a/contrib/grpcplugins/action/Makefile b/contrib/grpcplugins/action/Makefile index b12a688c68..836a5bf59e 100644 --- a/contrib/grpcplugins/action/Makefile +++ b/contrib/grpcplugins/action/Makefile @@ -1,110 +1,41 @@ -.PHONY: clean +##### =====> Commands <===== ##### -VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot${CDS_VERSION}) -GITHASH := $(if ${GIT_HASH},${GIT_HASH},`git log -1 --format="%H"`) -BUILDTIME := `date "+%m/%d/%y-%H:%M:%S"` +include ../../../.build/core.mk -TARGET_DIR = dist - -define PLUGIN_MANIFEST_BINARY -os: %os% -arch: %arch% -cmd: ./%filename% -endef -export PLUGIN_MANIFEST_BINARY - -GO_BUILD = go build -DIRS = `ls -d */ | cut -f1 -d'/'` - -default: build - -clean: - @rm -rf $(TARGET_DIR) - -TARGET_DIR = ./dist -isWindows = $(filter $1,windows) - -TARGET_LDFLAGS = -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION) -X github.com/ovh/cds/sdk.GOOS=$$GOOS -X github.com/ovh/cds/sdk.GOARCH=$$GOARCH -X github.com/ovh/cds/sdk.GITHASH=$(GITHASH) -X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME) -X github.com/ovh/cds/sdk.BINARY=$(TARGET_ENGINE) -X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)" -TARGET_OS = $(if ${OS},${OS},windows darwin linux freebsd) -TARGET_ARCH = $(if ${ARCH},${ARCH},amd64 arm 386) - -ALL_PLUGINS := $(if ${TARGET_NAME},${TARGET_NAME}, $(filter-out $(TARGET_DIR), $(shell for plugin in $(DIRS); do echo $(basename "$$plugin"); done))) -TARGET_PLUGINS := $(foreach PLUGIN, $(ALL_PLUGINS), $(TARGET_DIR)/plugin-$(PLUGIN)) +DIRS := `ls -d plugin-* | cut -f1 -d'/'` +ALL_PLUGINS := $(if ${TARGET_NAME},${TARGET_NAME}, $(filter-out $(TARGET_DIST), $(shell for plugin in $(DIRS); do echo $(basename "$$plugin"); done))) +TARGET_PLUGINS := $(foreach PLUGIN, $(ALL_PLUGINS), dist/$(PLUGIN).yml) TARGET_PLUGINS_DIST := $(foreach TARGET_PLUGIN, $(TARGET_PLUGINS), $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(TARGET_PLUGIN)-$(OS)-$(ARCH)$(if $(call isWindows, $(OS)),.exe)))) -TARGET_PLUGINS_MANIFEST_DIST := $(foreach TARGET_PLUGIN, $(TARGET_PLUGINS), $(TARGET_PLUGIN)-$(OS)-$(ARCH).yml) +TARGET_DIST := ./dist -define get_os_from_binary_file -$(strip $(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n-1]}')) +define get_plugin_name_from_conf +$(strip $(patsubst dist/%.yml, %,$(shell echo $(1)))) endef -define get_arch_from_binary_file -$(strip $(patsubst %.exe, %,$(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n]}'))) -endef +$(TARGET_PLUGINS): $(TARGET_DIST) + $(info building $(call get_plugin_name_from_conf,$@)) + @P=$(call get_plugin_name_from_conf,$@); \ + $(MAKE) build -C $$P -define get_executor_path_from_binary_file -$(strip $(patsubst dist/%, %, $(patsubst %-, %, $(shell echo $(1) |awk '{n=split($$1,a,"-");for (i = 2; i < n-1; i++) printf a[i] "-"}')))) -endef +build: $(TARGET_PLUGINS) -build: $(TARGET_PLUGINS_DIST) +.PHONY: dist -$(TARGET_DIR): - @mkdir $(TARGET_DIR) - -$(TARGET_PLUGINS_DIST): - $(info Compiling $@: $(abspath $@)) - $(MAKE) --no-print-directory gobuild PACKAGE=$(call get_executor_path_from_binary_file,$@) GOOS=$(call get_os_from_binary_file,$@) GOARCH=$(call get_arch_from_binary_file,$@) OUTPUT=$@ - $(MAKE) --no-print-directory manifestbuild PACKAGE=$(call get_executor_path_from_binary_file,$@) GOOS=$(call get_os_from_binary_file,$@) GOARCH=$(call get_arch_from_binary_file,$@) OUTPUT=$@ - -gobuild: - @if go tool dist list | grep "$$GOOS" | grep "$$GOARCH" > /dev/null; then \ - if [ -f $(PACKAGE)/go.mod ]; then \ - cd $(abspath $(PACKAGE)) && GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(abspath $(OUTPUT)); \ - fi; \ - fi - -manifestbuild: - @if go tool dist list | grep "$$GOOS" | grep "$$GOARCH" > /dev/null; then \ - if [ -f $(PACKAGE)/go.mod ]; then \ - echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ - perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ - perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ - EXTENSION=""; \ - if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ - FILENAME=plugin-$$PACKAGE-$$GOOS-$$GOARCH$$EXTENSION; \ - perl -pi -e s,%filename%,$$FILENAME,g $(TARGET_DIR)/plugin-$$PACKAGE-$$GOOS-$$GOARCH.yml; \ - pluginname=$$PACKAGE; \ - cp $$PACKAGE/$$pluginname.yml $(TARGET_DIR)/plugin-$$PACKAGE.yml; \ - fi; \ - fi - -display: - $(info $(TARGET_PLUGINS_DIST)) - -publish-all: - @echo "Updating plugins..." - @for plugin in $(DIRS); do \ - pluginname=$(basename "$$plugin"); \ - if test "$$pluginname" = "examples" ; then continue; fi; \ - if test "$$pluginname" = "dist" ; then continue; fi; \ - cdsctl admin plugins import $(TARGET_DIR)/plugin-$$plugin.yml; \ - for GOOS in $(TARGET_OS); do \ - for GOARCH in $(TARGET_ARCH); do \ - EXTENSION=""; \ - if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ - echo "Updating plugin binary $$pluginname-$$GOOS-$$GOARCH$$EXTENSION"; \ - cdsctl admin plugins binary-add plugin-$$pluginname $(TARGET_DIR)/plugin-$$pluginname-$$GOOS-$$GOARCH.yml $(TARGET_DIR)/plugin-$$pluginname-$$GOOS-$$GOARCH$$EXTENSION; \ - done; \ +dist: + @mkdir -p dist + @for PLU in $(ALL_PLUGINS); do \ + for F in `find $$PLU/dist -name "$$PLU*"`; do \ + mv $$F dist/; \ done; \ done; -publish: - @echo "Updating plugin $(TARGET_NAME)..." - cdsctl admin plugins import $(TARGET_DIR)/plugin-$(TARGET_NAME).yml - @for GOOS in $(TARGET_OS); do \ - for GOARCH in $(TARGET_ARCH); do \ - EXTENSION=""; \ - if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ - echo "Updating plugin binary $(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION"; \ - cdsctl admin plugins binary-add plugin-$(TARGET_NAME) $(TARGET_DIR)/plugin-$(TARGET_NAME)-$$GOOS-$$GOARCH.yml $(TARGET_DIR)/plugin-$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ - done; \ - done +publish: + @for P in $(ALL_PLUGINS); do \ + $(MAKE) publish -C $$P; \ + done; + +clean: + @rm -rf $(TARGET_DIST) + @for P in $(ALL_PLUGINS); do \ + $(MAKE) clean -C $$P; \ + done; diff --git a/contrib/grpcplugins/action/archive/.gitignore b/contrib/grpcplugins/action/plugin-archive/.gitignore similarity index 100% rename from contrib/grpcplugins/action/archive/.gitignore rename to contrib/grpcplugins/action/plugin-archive/.gitignore diff --git a/contrib/grpcplugins/action/plugin-archive/Makefile b/contrib/grpcplugins/action/plugin-archive/Makefile new file mode 100644 index 0000000000..7923507828 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-archive/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-archive + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/archive/go.mod b/contrib/grpcplugins/action/plugin-archive/go.mod similarity index 100% rename from contrib/grpcplugins/action/archive/go.mod rename to contrib/grpcplugins/action/plugin-archive/go.mod diff --git a/contrib/grpcplugins/action/archive/go.sum b/contrib/grpcplugins/action/plugin-archive/go.sum similarity index 99% rename from contrib/grpcplugins/action/archive/go.sum rename to contrib/grpcplugins/action/plugin-archive/go.sum index 36cb5d3f5c..0bb0232c5e 100644 --- a/contrib/grpcplugins/action/archive/go.sum +++ b/contrib/grpcplugins/action/plugin-archive/go.sum @@ -242,6 +242,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= diff --git a/contrib/grpcplugins/action/archive/main.go b/contrib/grpcplugins/action/plugin-archive/main.go similarity index 100% rename from contrib/grpcplugins/action/archive/main.go rename to contrib/grpcplugins/action/plugin-archive/main.go diff --git a/contrib/grpcplugins/action/archive/archive.yml b/contrib/grpcplugins/action/plugin-archive/plugin-archive.yml similarity index 100% rename from contrib/grpcplugins/action/archive/archive.yml rename to contrib/grpcplugins/action/plugin-archive/plugin-archive.yml diff --git a/contrib/grpcplugins/action/archive/plugin_test.go b/contrib/grpcplugins/action/plugin-archive/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/archive/plugin_test.go rename to contrib/grpcplugins/action/plugin-archive/plugin_test.go diff --git a/contrib/grpcplugins/action/clair/.gitignore b/contrib/grpcplugins/action/plugin-clair/.gitignore similarity index 100% rename from contrib/grpcplugins/action/clair/.gitignore rename to contrib/grpcplugins/action/plugin-clair/.gitignore diff --git a/contrib/grpcplugins/action/plugin-clair/Makefile b/contrib/grpcplugins/action/plugin-clair/Makefile new file mode 100644 index 0000000000..9305ec5d3b --- /dev/null +++ b/contrib/grpcplugins/action/plugin-clair/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-clair + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/clair/clairctl/LICENSE b/contrib/grpcplugins/action/plugin-clair/clairctl/LICENSE similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/LICENSE rename to contrib/grpcplugins/action/plugin-clair/clairctl/LICENSE diff --git a/contrib/grpcplugins/action/clair/clairctl/clair/analyze.go b/contrib/grpcplugins/action/plugin-clair/clairctl/clair/analyze.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/clair/analyze.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/clair/analyze.go diff --git a/contrib/grpcplugins/action/clair/clairctl/clair/clair.go b/contrib/grpcplugins/action/plugin-clair/clairctl/clair/clair.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/clair/clair.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/clair/clair.go diff --git a/contrib/grpcplugins/action/clair/clairctl/clair/layering.go b/contrib/grpcplugins/action/plugin-clair/clairctl/clair/layering.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/clair/layering.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/clair/layering.go diff --git a/contrib/grpcplugins/action/clair/clairctl/clair/push.go b/contrib/grpcplugins/action/plugin-clair/clairctl/clair/push.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/clair/push.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/clair/push.go diff --git a/contrib/grpcplugins/action/clair/clairctl/config/config.go b/contrib/grpcplugins/action/plugin-clair/clairctl/config/config.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/config/config.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/config/config.go diff --git a/contrib/grpcplugins/action/clair/clairctl/docker/docker.go b/contrib/grpcplugins/action/plugin-clair/clairctl/docker/docker.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/docker/docker.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/docker/docker.go diff --git a/contrib/grpcplugins/action/clair/clairctl/docker/dockercli/dockercli.go b/contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockercli/dockercli.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/docker/dockercli/dockercli.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockercli/dockercli.go diff --git a/contrib/grpcplugins/action/clair/clairctl/docker/dockerdist/auth.go b/contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockerdist/auth.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/docker/dockerdist/auth.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockerdist/auth.go diff --git a/contrib/grpcplugins/action/clair/clairctl/docker/dockerdist/dockerdist.go b/contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockerdist/dockerdist.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/docker/dockerdist/dockerdist.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/docker/dockerdist/dockerdist.go diff --git a/contrib/grpcplugins/action/clair/clairctl/xstrings/xstrings.go b/contrib/grpcplugins/action/plugin-clair/clairctl/xstrings/xstrings.go similarity index 100% rename from contrib/grpcplugins/action/clair/clairctl/xstrings/xstrings.go rename to contrib/grpcplugins/action/plugin-clair/clairctl/xstrings/xstrings.go diff --git a/contrib/grpcplugins/action/clair/go.mod b/contrib/grpcplugins/action/plugin-clair/go.mod similarity index 100% rename from contrib/grpcplugins/action/clair/go.mod rename to contrib/grpcplugins/action/plugin-clair/go.mod diff --git a/contrib/grpcplugins/action/clair/go.sum b/contrib/grpcplugins/action/plugin-clair/go.sum similarity index 99% rename from contrib/grpcplugins/action/clair/go.sum rename to contrib/grpcplugins/action/plugin-clair/go.sum index 64f1e58bbb..464dff4781 100644 --- a/contrib/grpcplugins/action/clair/go.sum +++ b/contrib/grpcplugins/action/plugin-clair/go.sum @@ -243,6 +243,7 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= diff --git a/contrib/grpcplugins/action/clair/main.go b/contrib/grpcplugins/action/plugin-clair/main.go similarity index 100% rename from contrib/grpcplugins/action/clair/main.go rename to contrib/grpcplugins/action/plugin-clair/main.go diff --git a/contrib/grpcplugins/action/clair/clair.yml b/contrib/grpcplugins/action/plugin-clair/plugin-clair.yml similarity index 100% rename from contrib/grpcplugins/action/clair/clair.yml rename to contrib/grpcplugins/action/plugin-clair/plugin-clair.yml diff --git a/contrib/grpcplugins/action/download/.gitignore b/contrib/grpcplugins/action/plugin-download/.gitignore similarity index 100% rename from contrib/grpcplugins/action/download/.gitignore rename to contrib/grpcplugins/action/plugin-download/.gitignore diff --git a/contrib/grpcplugins/action/plugin-download/Makefile b/contrib/grpcplugins/action/plugin-download/Makefile new file mode 100644 index 0000000000..56f07e8bba --- /dev/null +++ b/contrib/grpcplugins/action/plugin-download/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-download + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/download/go.mod b/contrib/grpcplugins/action/plugin-download/go.mod similarity index 100% rename from contrib/grpcplugins/action/download/go.mod rename to contrib/grpcplugins/action/plugin-download/go.mod diff --git a/contrib/grpcplugins/action/download/go.sum b/contrib/grpcplugins/action/plugin-download/go.sum similarity index 100% rename from contrib/grpcplugins/action/download/go.sum rename to contrib/grpcplugins/action/plugin-download/go.sum diff --git a/contrib/grpcplugins/action/download/main.go b/contrib/grpcplugins/action/plugin-download/main.go similarity index 100% rename from contrib/grpcplugins/action/download/main.go rename to contrib/grpcplugins/action/plugin-download/main.go diff --git a/contrib/grpcplugins/action/download/download.yml b/contrib/grpcplugins/action/plugin-download/plugin-download.yml similarity index 100% rename from contrib/grpcplugins/action/download/download.yml rename to contrib/grpcplugins/action/plugin-download/plugin-download.yml diff --git a/contrib/grpcplugins/action/download/plugin_test.go b/contrib/grpcplugins/action/plugin-download/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/download/plugin_test.go rename to contrib/grpcplugins/action/plugin-download/plugin_test.go diff --git a/contrib/grpcplugins/action/group-tmpl/.gitignore b/contrib/grpcplugins/action/plugin-group-tmpl/.gitignore similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/.gitignore rename to contrib/grpcplugins/action/plugin-group-tmpl/.gitignore diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile new file mode 100644 index 0000000000..43c3cc9941 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-group-tmpl + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/group-tmpl/applications.go b/contrib/grpcplugins/action/plugin-group-tmpl/applications.go similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/applications.go rename to contrib/grpcplugins/action/plugin-group-tmpl/applications.go diff --git a/contrib/grpcplugins/action/group-tmpl/applications_test.go b/contrib/grpcplugins/action/plugin-group-tmpl/applications_test.go similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/applications_test.go rename to contrib/grpcplugins/action/plugin-group-tmpl/applications_test.go diff --git a/contrib/grpcplugins/action/group-tmpl/go.mod b/contrib/grpcplugins/action/plugin-group-tmpl/go.mod similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/go.mod rename to contrib/grpcplugins/action/plugin-group-tmpl/go.mod diff --git a/contrib/grpcplugins/action/group-tmpl/go.sum b/contrib/grpcplugins/action/plugin-group-tmpl/go.sum similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/go.sum rename to contrib/grpcplugins/action/plugin-group-tmpl/go.sum diff --git a/contrib/grpcplugins/action/group-tmpl/main.go b/contrib/grpcplugins/action/plugin-group-tmpl/main.go similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/main.go rename to contrib/grpcplugins/action/plugin-group-tmpl/main.go diff --git a/contrib/grpcplugins/action/group-tmpl/group-tmpl.yml b/contrib/grpcplugins/action/plugin-group-tmpl/plugin-group-tmpl.yml similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/group-tmpl.yml rename to contrib/grpcplugins/action/plugin-group-tmpl/plugin-group-tmpl.yml diff --git a/contrib/grpcplugins/action/group-tmpl/plugin_test.go b/contrib/grpcplugins/action/plugin-group-tmpl/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/plugin_test.go rename to contrib/grpcplugins/action/plugin-group-tmpl/plugin_test.go diff --git a/contrib/grpcplugins/action/group-tmpl/templates.go b/contrib/grpcplugins/action/plugin-group-tmpl/templates.go similarity index 100% rename from contrib/grpcplugins/action/group-tmpl/templates.go rename to contrib/grpcplugins/action/plugin-group-tmpl/templates.go diff --git a/contrib/grpcplugins/action/kafka-publish/.gitignore b/contrib/grpcplugins/action/plugin-kafka-publish/.gitignore similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/.gitignore rename to contrib/grpcplugins/action/plugin-kafka-publish/.gitignore diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile new file mode 100644 index 0000000000..436dfae457 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-kafka-publish + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/kafka-publish/README.md b/contrib/grpcplugins/action/plugin-kafka-publish/README.md similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/README.md rename to contrib/grpcplugins/action/plugin-kafka-publish/README.md diff --git a/contrib/grpcplugins/action/kafka-publish/cli.go b/contrib/grpcplugins/action/plugin-kafka-publish/cli.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/cli.go rename to contrib/grpcplugins/action/plugin-kafka-publish/cli.go diff --git a/contrib/grpcplugins/action/kafka-publish/cli_actions.go b/contrib/grpcplugins/action/plugin-kafka-publish/cli_actions.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/cli_actions.go rename to contrib/grpcplugins/action/plugin-kafka-publish/cli_actions.go diff --git a/contrib/grpcplugins/action/kafka-publish/go.mod b/contrib/grpcplugins/action/plugin-kafka-publish/go.mod similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/go.mod rename to contrib/grpcplugins/action/plugin-kafka-publish/go.mod diff --git a/contrib/grpcplugins/action/kafka-publish/go.sum b/contrib/grpcplugins/action/plugin-kafka-publish/go.sum similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/go.sum rename to contrib/grpcplugins/action/plugin-kafka-publish/go.sum diff --git a/contrib/grpcplugins/action/kafka-publish/kafka.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafka.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafka.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafka.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafka_ack.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafka_ack.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafka_ack.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafka_ack.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafka_consumer.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafka_consumer.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafka_consumer.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafka_consumer.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafkapublisher/chunks.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafkapublisher/chunks.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafkapublisher/chunks_test.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafkapublisher/chunks_test.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafkapublisher/context.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/context.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafkapublisher/context.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/context.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafkapublisher/types.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/types.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafkapublisher/types.go rename to contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/types.go diff --git a/contrib/grpcplugins/action/kafka-publish/log.go b/contrib/grpcplugins/action/plugin-kafka-publish/log.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/log.go rename to contrib/grpcplugins/action/plugin-kafka-publish/log.go diff --git a/contrib/grpcplugins/action/kafka-publish/main.go b/contrib/grpcplugins/action/plugin-kafka-publish/main.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/main.go rename to contrib/grpcplugins/action/plugin-kafka-publish/main.go diff --git a/contrib/grpcplugins/action/kafka-publish/kafka-publish.yml b/contrib/grpcplugins/action/plugin-kafka-publish/plugin-kafka-publish.yml similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/kafka-publish.yml rename to contrib/grpcplugins/action/plugin-kafka-publish/plugin-kafka-publish.yml diff --git a/contrib/grpcplugins/action/kafka-publish/plugin_test.go b/contrib/grpcplugins/action/plugin-kafka-publish/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/kafka-publish/plugin_test.go rename to contrib/grpcplugins/action/plugin-kafka-publish/plugin_test.go diff --git a/contrib/grpcplugins/action/marathon/.gitignore b/contrib/grpcplugins/action/plugin-marathon/.gitignore similarity index 100% rename from contrib/grpcplugins/action/marathon/.gitignore rename to contrib/grpcplugins/action/plugin-marathon/.gitignore diff --git a/contrib/grpcplugins/action/plugin-marathon/Makefile b/contrib/grpcplugins/action/plugin-marathon/Makefile new file mode 100644 index 0000000000..14bc65e0d6 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-marathon/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-marathon + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/marathon/README.md b/contrib/grpcplugins/action/plugin-marathon/README.md similarity index 100% rename from contrib/grpcplugins/action/marathon/README.md rename to contrib/grpcplugins/action/plugin-marathon/README.md diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon1.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon1.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon1.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon1.json diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon2.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon2.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon2.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon2.json diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon3.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon3.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon3.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon3.json diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon4.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon4.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon4.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon4.json diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon5.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon5.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon5.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon5.json diff --git a/contrib/grpcplugins/action/marathon/fixtures/marathon6.json b/contrib/grpcplugins/action/plugin-marathon/fixtures/marathon6.json similarity index 100% rename from contrib/grpcplugins/action/marathon/fixtures/marathon6.json rename to contrib/grpcplugins/action/plugin-marathon/fixtures/marathon6.json diff --git a/contrib/grpcplugins/action/marathon/go.mod b/contrib/grpcplugins/action/plugin-marathon/go.mod similarity index 100% rename from contrib/grpcplugins/action/marathon/go.mod rename to contrib/grpcplugins/action/plugin-marathon/go.mod diff --git a/contrib/grpcplugins/action/marathon/go.sum b/contrib/grpcplugins/action/plugin-marathon/go.sum similarity index 100% rename from contrib/grpcplugins/action/marathon/go.sum rename to contrib/grpcplugins/action/plugin-marathon/go.sum diff --git a/contrib/grpcplugins/action/marathon/main.go b/contrib/grpcplugins/action/plugin-marathon/main.go similarity index 100% rename from contrib/grpcplugins/action/marathon/main.go rename to contrib/grpcplugins/action/plugin-marathon/main.go diff --git a/contrib/grpcplugins/action/marathon/marathon_schema.go b/contrib/grpcplugins/action/plugin-marathon/marathon_schema.go similarity index 100% rename from contrib/grpcplugins/action/marathon/marathon_schema.go rename to contrib/grpcplugins/action/plugin-marathon/marathon_schema.go diff --git a/contrib/grpcplugins/action/marathon/marathon.yml b/contrib/grpcplugins/action/plugin-marathon/plugin-marathon.yml similarity index 100% rename from contrib/grpcplugins/action/marathon/marathon.yml rename to contrib/grpcplugins/action/plugin-marathon/plugin-marathon.yml diff --git a/contrib/grpcplugins/action/marathon/plugin_test.go b/contrib/grpcplugins/action/plugin-marathon/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/marathon/plugin_test.go rename to contrib/grpcplugins/action/plugin-marathon/plugin_test.go diff --git a/contrib/grpcplugins/action/npm-audit-parser/.gitignore b/contrib/grpcplugins/action/plugin-npm-audit-parser/.gitignore similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/.gitignore rename to contrib/grpcplugins/action/plugin-npm-audit-parser/.gitignore diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile new file mode 100644 index 0000000000..2b2915e669 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-npm-audit-parser + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/npm-audit-parser/go.mod b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/go.mod rename to contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod diff --git a/contrib/grpcplugins/action/npm-audit-parser/go.sum b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/go.sum rename to contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum diff --git a/contrib/grpcplugins/action/npm-audit-parser/main.go b/contrib/grpcplugins/action/plugin-npm-audit-parser/main.go similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/main.go rename to contrib/grpcplugins/action/plugin-npm-audit-parser/main.go diff --git a/contrib/grpcplugins/action/npm-audit-parser/npm-audit-parser.yml b/contrib/grpcplugins/action/plugin-npm-audit-parser/plugin-npm-audit-parser.yml similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/npm-audit-parser.yml rename to contrib/grpcplugins/action/plugin-npm-audit-parser/plugin-npm-audit-parser.yml diff --git a/contrib/grpcplugins/action/npm-audit-parser/types.go b/contrib/grpcplugins/action/plugin-npm-audit-parser/types.go similarity index 100% rename from contrib/grpcplugins/action/npm-audit-parser/types.go rename to contrib/grpcplugins/action/plugin-npm-audit-parser/types.go diff --git a/contrib/grpcplugins/action/ssh-cmd/.gitignore b/contrib/grpcplugins/action/plugin-ssh-cmd/.gitignore similarity index 100% rename from contrib/grpcplugins/action/ssh-cmd/.gitignore rename to contrib/grpcplugins/action/plugin-ssh-cmd/.gitignore diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile new file mode 100644 index 0000000000..eafda45d25 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-ssh-cmd + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/ssh-cmd/go.mod b/contrib/grpcplugins/action/plugin-ssh-cmd/go.mod similarity index 100% rename from contrib/grpcplugins/action/ssh-cmd/go.mod rename to contrib/grpcplugins/action/plugin-ssh-cmd/go.mod diff --git a/contrib/grpcplugins/action/ssh-cmd/go.sum b/contrib/grpcplugins/action/plugin-ssh-cmd/go.sum similarity index 100% rename from contrib/grpcplugins/action/ssh-cmd/go.sum rename to contrib/grpcplugins/action/plugin-ssh-cmd/go.sum diff --git a/contrib/grpcplugins/action/ssh-cmd/main.go b/contrib/grpcplugins/action/plugin-ssh-cmd/main.go similarity index 100% rename from contrib/grpcplugins/action/ssh-cmd/main.go rename to contrib/grpcplugins/action/plugin-ssh-cmd/main.go diff --git a/contrib/grpcplugins/action/ssh-cmd/ssh-cmd.yml b/contrib/grpcplugins/action/plugin-ssh-cmd/plugin-ssh-cmd.yml similarity index 100% rename from contrib/grpcplugins/action/ssh-cmd/ssh-cmd.yml rename to contrib/grpcplugins/action/plugin-ssh-cmd/plugin-ssh-cmd.yml diff --git a/contrib/grpcplugins/action/tmpl/.gitignore b/contrib/grpcplugins/action/plugin-tmpl/.gitignore similarity index 100% rename from contrib/grpcplugins/action/tmpl/.gitignore rename to contrib/grpcplugins/action/plugin-tmpl/.gitignore diff --git a/contrib/grpcplugins/action/plugin-tmpl/Makefile b/contrib/grpcplugins/action/plugin-tmpl/Makefile new file mode 100644 index 0000000000..f3a693d47a --- /dev/null +++ b/contrib/grpcplugins/action/plugin-tmpl/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-tmpl + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/tmpl/go.mod b/contrib/grpcplugins/action/plugin-tmpl/go.mod similarity index 100% rename from contrib/grpcplugins/action/tmpl/go.mod rename to contrib/grpcplugins/action/plugin-tmpl/go.mod diff --git a/contrib/grpcplugins/action/tmpl/go.sum b/contrib/grpcplugins/action/plugin-tmpl/go.sum similarity index 100% rename from contrib/grpcplugins/action/tmpl/go.sum rename to contrib/grpcplugins/action/plugin-tmpl/go.sum diff --git a/contrib/grpcplugins/action/tmpl/main.go b/contrib/grpcplugins/action/plugin-tmpl/main.go similarity index 100% rename from contrib/grpcplugins/action/tmpl/main.go rename to contrib/grpcplugins/action/plugin-tmpl/main.go diff --git a/contrib/grpcplugins/action/tmpl/tmpl.yml b/contrib/grpcplugins/action/plugin-tmpl/plugin-tmpl.yml similarity index 100% rename from contrib/grpcplugins/action/tmpl/tmpl.yml rename to contrib/grpcplugins/action/plugin-tmpl/plugin-tmpl.yml diff --git a/contrib/grpcplugins/action/tmpl/plugin_test.go b/contrib/grpcplugins/action/plugin-tmpl/plugin_test.go similarity index 100% rename from contrib/grpcplugins/action/tmpl/plugin_test.go rename to contrib/grpcplugins/action/plugin-tmpl/plugin_test.go diff --git a/contrib/grpcplugins/action/venom/.gitignore b/contrib/grpcplugins/action/plugin-venom/.gitignore similarity index 100% rename from contrib/grpcplugins/action/venom/.gitignore rename to contrib/grpcplugins/action/plugin-venom/.gitignore diff --git a/contrib/grpcplugins/action/plugin-venom/Makefile b/contrib/grpcplugins/action/plugin-venom/Makefile new file mode 100644 index 0000000000..88e4978536 --- /dev/null +++ b/contrib/grpcplugins/action/plugin-venom/Makefile @@ -0,0 +1,9 @@ + +TARGET_NAME = plugin-venom + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +include ../../../../.build/core.mk +include ../../../../.build/go.mk +include ../../../../.build/plugin.mk + diff --git a/contrib/grpcplugins/action/venom/go.mod b/contrib/grpcplugins/action/plugin-venom/go.mod similarity index 100% rename from contrib/grpcplugins/action/venom/go.mod rename to contrib/grpcplugins/action/plugin-venom/go.mod diff --git a/contrib/grpcplugins/action/venom/go.sum b/contrib/grpcplugins/action/plugin-venom/go.sum similarity index 100% rename from contrib/grpcplugins/action/venom/go.sum rename to contrib/grpcplugins/action/plugin-venom/go.sum diff --git a/contrib/grpcplugins/action/venom/main.go b/contrib/grpcplugins/action/plugin-venom/main.go similarity index 100% rename from contrib/grpcplugins/action/venom/main.go rename to contrib/grpcplugins/action/plugin-venom/main.go diff --git a/contrib/grpcplugins/action/venom/venom.yml b/contrib/grpcplugins/action/plugin-venom/plugin-venom.yml similarity index 100% rename from contrib/grpcplugins/action/venom/venom.yml rename to contrib/grpcplugins/action/plugin-venom/plugin-venom.yml diff --git a/contrib/grpcplugins/action/venom/tests/file1.yml b/contrib/grpcplugins/action/plugin-venom/tests/file1.yml similarity index 100% rename from contrib/grpcplugins/action/venom/tests/file1.yml rename to contrib/grpcplugins/action/plugin-venom/tests/file1.yml diff --git a/contrib/grpcplugins/action/venom/tests/file2.yml b/contrib/grpcplugins/action/plugin-venom/tests/file2.yml similarity index 100% rename from contrib/grpcplugins/action/venom/tests/file2.yml rename to contrib/grpcplugins/action/plugin-venom/tests/file2.yml diff --git a/contrib/grpcplugins/action/venom/tests/subtest/file3.yml b/contrib/grpcplugins/action/plugin-venom/tests/subtest/file3.yml similarity index 100% rename from contrib/grpcplugins/action/venom/tests/subtest/file3.yml rename to contrib/grpcplugins/action/plugin-venom/tests/subtest/file3.yml diff --git a/contrib/grpcplugins/action/venom/venom_test.go b/contrib/grpcplugins/action/plugin-venom/venom_test.go similarity index 100% rename from contrib/grpcplugins/action/venom/venom_test.go rename to contrib/grpcplugins/action/plugin-venom/venom_test.go From 261a0541931de4a8e54337056017ff5dd31ae150 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 09:09:26 +0200 Subject: [PATCH 03/12] fix(plugins): make package Signed-off-by: Yvonnick Esnault --- contrib/grpcplugins/action/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/grpcplugins/action/Makefile b/contrib/grpcplugins/action/Makefile index 836a5bf59e..b756367b11 100644 --- a/contrib/grpcplugins/action/Makefile +++ b/contrib/grpcplugins/action/Makefile @@ -21,7 +21,7 @@ build: $(TARGET_PLUGINS) .PHONY: dist -dist: +package: @mkdir -p dist @for PLU in $(ALL_PLUGINS); do \ for F in `find $$PLU/dist -name "$$PLU*"`; do \ From cae56037c2f7318caaf6910c17067940edaa83b5 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 11:34:00 +0200 Subject: [PATCH 04/12] fix(plugins): wip plugins Signed-off-by: Yvonnick Esnault --- .build/go.mk | 2 +- .build/plugin.mk | 8 ++++---- contrib/grpcplugins/action/plugin-archive/Makefile | 3 +++ contrib/grpcplugins/action/plugin-clair/Makefile | 6 ++++++ contrib/grpcplugins/action/plugin-download/Makefile | 3 +++ contrib/grpcplugins/action/plugin-group-tmpl/Makefile | 3 +++ contrib/grpcplugins/action/plugin-kafka-publish/Makefile | 3 +++ contrib/grpcplugins/action/plugin-marathon/Makefile | 3 +++ .../grpcplugins/action/plugin-npm-audit-parser/Makefile | 3 +++ contrib/grpcplugins/action/plugin-ssh-cmd/Makefile | 3 +++ contrib/grpcplugins/action/plugin-tmpl/Makefile | 3 +++ contrib/grpcplugins/action/plugin-venom/Makefile | 3 +++ 12 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.build/go.mk b/.build/go.mk index 994499af30..b858688bdf 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -28,7 +28,7 @@ mk_go_clean: # clean target directory ##### =====> Compile <===== ##### IS_TEST := $(filter test,$(MAKECMDGOALS)) -TARGET_OS := $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), darwin linux freebsd)),$(shell go env GOOS)) +TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), darwin linux freebsd)),$(shell go env GOOS))) TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64)) BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES))) diff --git a/.build/plugin.mk b/.build/plugin.mk index 13f22b5874..22e4f47260 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -1,7 +1,7 @@ BINARIES_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH).yml, $(notdir $(TARGET_NAME)))) PLUGIN_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix .yml, $(notdir $(TARGET_NAME)))) -CROSS_COMPILED_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES_CONF))) +CROSS_COMPILED_PLUGIN_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES_CONF))) define PLUGIN_MANIFEST_BINARY os: %os% @@ -39,7 +39,9 @@ $(PLUGIN_CONF): $(TARGET_DIST) $(info *** prepare conf $@) @cp $(TARGET_NAME).yml $@; -publish: +mk_go_build_plugin: $(CROSS_COMPILED_PLUGIN_CONF) $(PLUGIN_CONF) $(CROSS_COMPILED_BINARIES) + +mk_plugin_publish: @echo "Updating plugin $(TARGET_NAME)..." cdsctl admin plugins import $(TARGET_DIST)/$(TARGET_NAME).yml @for GOOS in $(TARGET_OS); do \ @@ -51,7 +53,5 @@ publish: done; \ done -build: $(CROSS_COMPILED_PLUGIN_CONF) $(PLUGIN_CONF) $(CROSS_COMPILED_BINARIES) ## build action plugin and prepare configuration - clean: @rm -rf dist diff --git a/contrib/grpcplugins/action/plugin-archive/Makefile b/contrib/grpcplugins/action/plugin-archive/Makefile index 7923507828..e3720f3f95 100644 --- a/contrib/grpcplugins/action/plugin-archive/Makefile +++ b/contrib/grpcplugins/action/plugin-archive/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-clair/Makefile b/contrib/grpcplugins/action/plugin-clair/Makefile index 9305ec5d3b..54f9fe66c0 100644 --- a/contrib/grpcplugins/action/plugin-clair/Makefile +++ b/contrib/grpcplugins/action/plugin-clair/Makefile @@ -1,5 +1,6 @@ TARGET_NAME = plugin-clair +TARGET_OS_EXCLUDED = freebsd ##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### @@ -7,3 +8,8 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +.IGNORE: dist/* + +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-download/Makefile b/contrib/grpcplugins/action/plugin-download/Makefile index 56f07e8bba..fd72dbc9ec 100644 --- a/contrib/grpcplugins/action/plugin-download/Makefile +++ b/contrib/grpcplugins/action/plugin-download/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile index 43c3cc9941..b3119aa503 100644 --- a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile index 436dfae457..030d788f1b 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile +++ b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-marathon/Makefile b/contrib/grpcplugins/action/plugin-marathon/Makefile index 14bc65e0d6..aff77c3a44 100644 --- a/contrib/grpcplugins/action/plugin-marathon/Makefile +++ b/contrib/grpcplugins/action/plugin-marathon/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile index 2b2915e669..c9327c2478 100644 --- a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile index eafda45d25..0916ab96cf 100644 --- a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-tmpl/Makefile b/contrib/grpcplugins/action/plugin-tmpl/Makefile index f3a693d47a..82150abd51 100644 --- a/contrib/grpcplugins/action/plugin-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-tmpl/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. diff --git a/contrib/grpcplugins/action/plugin-venom/Makefile b/contrib/grpcplugins/action/plugin-venom/Makefile index 88e4978536..babc1bae34 100644 --- a/contrib/grpcplugins/action/plugin-venom/Makefile +++ b/contrib/grpcplugins/action/plugin-venom/Makefile @@ -7,3 +7,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk +build: mk_go_build_plugin ## build action plugin and prepare configuration for publish + +publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. From 661da09d98063df08f8a1fee636594f6ec7dc4b6 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 11:44:38 +0200 Subject: [PATCH 05/12] fix(plugins): yml plugin Signed-off-by: Yvonnick Esnault --- .build/plugin.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.build/plugin.mk b/.build/plugin.mk index 22e4f47260..1cb42ac1f1 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -18,6 +18,10 @@ define get_arch_from_binary_file $(strip $(patsubst %.exe, %,$(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n]}'))) endef +define get_arch_from_conf_file +$(strip $(patsubst %.yml, %,$(shell echo $(1) | awk '{n=split($$1,a,"-");print a[n]}'))) +endef + define get_executor_path_from_binary_file $(strip $(patsubst dist/%, %, $(patsubst %-, %, $(shell echo $(1) |awk '{n=split($$1,a,"-");for (i = 2; i < n-1; i++) printf a[i] "-"}')))) endef @@ -27,7 +31,7 @@ $(CROSS_COMPILED_PLUGIN_CONF): $(GOFILES) $(TARGET_DIST) $(info *** prepare conf $@) @echo "$$PLUGIN_MANIFEST_BINARY" > $@; \ OS=$(call get_os_from_binary_file,$@); \ - ARCH=$(call get_arch_from_binary_file,$@); \ + ARCH=$(call get_arch_from_conf_file,$@); \ perl -pi -e s,%os%,$$OS,g $@ ; \ perl -pi -e s,%arch%,$$ARCH,g $@ ; \ EXTENSION=""; \ From 7b104b6a723a3b2e969810abd4516ab21bd0fe03 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 12:09:21 +0200 Subject: [PATCH 06/12] fix(plugins): cache Signed-off-by: Yvonnick Esnault --- .build/go.mk | 9 +++++---- .build/plugin.mk | 10 ++++++---- contrib/grpcplugins/action/plugin-clair/Makefile | 2 -- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.build/go.mk b/.build/go.mk index b858688bdf..f8f458fcbd 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -28,8 +28,8 @@ mk_go_clean: # clean target directory ##### =====> Compile <===== ##### IS_TEST := $(filter test,$(MAKECMDGOALS)) -TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), darwin linux freebsd)),$(shell go env GOOS))) -TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64)) +TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux freebsd)),$(shell go env GOOS))) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64)) BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES))) GOFILES = $(call get_recursive_files, '.') @@ -37,9 +37,10 @@ GOFILES = $(call get_recursive_files, '.') mk_go_build: $(info *** mk_go_build) -$(CROSS_COMPILED_BINARIES): $(GOFILES) $(TARGET_DIST) +$(CROSS_COMPILED_BINARIES): $(GOFILES) $(info *** compiling $@) - @GOOS=$(call get_os_from_binary_file,$@) \ + @mkdir -p $(TARGET_DIST); \ + GOOS=$(call get_os_from_binary_file,$@) \ GOARCH=$(call get_arch_from_binary_file,$@) \ $(GO_BUILD) $(LDFLAGS) -o $@; diff --git a/.build/plugin.mk b/.build/plugin.mk index 1cb42ac1f1..6478950e8a 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -27,9 +27,10 @@ $(strip $(patsubst dist/%, %, $(patsubst %-, %, $(shell echo $(1) |awk '{n=split endef ## Prepare yml file for each os-arch -$(CROSS_COMPILED_PLUGIN_CONF): $(GOFILES) $(TARGET_DIST) +$(CROSS_COMPILED_PLUGIN_CONF): $(GOFILES) $(info *** prepare conf $@) - @echo "$$PLUGIN_MANIFEST_BINARY" > $@; \ + @mkdir -p $(TARGET_DIST); \ + echo "$$PLUGIN_MANIFEST_BINARY" > $@; \ OS=$(call get_os_from_binary_file,$@); \ ARCH=$(call get_arch_from_conf_file,$@); \ perl -pi -e s,%os%,$$OS,g $@ ; \ @@ -39,9 +40,10 @@ $(CROSS_COMPILED_PLUGIN_CONF): $(GOFILES) $(TARGET_DIST) FILENAME=$(TARGET_NAME)-$$OS-$$ARCH$$EXTENSION; \ perl -pi -e s,%filename%,$$FILENAME,g $@ -$(PLUGIN_CONF): $(TARGET_DIST) +$(PLUGIN_CONF): $(info *** prepare conf $@) - @cp $(TARGET_NAME).yml $@; + @mkdir -p $(TARGET_DIST); \ + cp $(TARGET_NAME).yml $@; mk_go_build_plugin: $(CROSS_COMPILED_PLUGIN_CONF) $(PLUGIN_CONF) $(CROSS_COMPILED_BINARIES) diff --git a/contrib/grpcplugins/action/plugin-clair/Makefile b/contrib/grpcplugins/action/plugin-clair/Makefile index 54f9fe66c0..66fa87b1dc 100644 --- a/contrib/grpcplugins/action/plugin-clair/Makefile +++ b/contrib/grpcplugins/action/plugin-clair/Makefile @@ -8,8 +8,6 @@ include ../../../../.build/core.mk include ../../../../.build/go.mk include ../../../../.build/plugin.mk -.IGNORE: dist/* - build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. From 4b41eb4a7b07145b6872ef53ca75d2eb7008ec57 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 15:45:30 +0200 Subject: [PATCH 07/12] fix(plugins): make package Signed-off-by: Yvonnick Esnault --- .build/go.mk | 8 +++++--- .build/plugin.mk | 5 ++++- contrib/grpcplugins/action/Makefile | 7 ++++--- contrib/grpcplugins/action/plugin-archive/Makefile | 2 ++ contrib/grpcplugins/action/plugin-clair/Makefile | 6 ++++-- contrib/grpcplugins/action/plugin-clair/go.sum | 1 + contrib/grpcplugins/action/plugin-download/Makefile | 2 ++ contrib/grpcplugins/action/plugin-download/go.sum | 2 ++ contrib/grpcplugins/action/plugin-group-tmpl/Makefile | 2 ++ contrib/grpcplugins/action/plugin-group-tmpl/go.sum | 2 ++ contrib/grpcplugins/action/plugin-kafka-publish/Makefile | 2 ++ contrib/grpcplugins/action/plugin-kafka-publish/go.sum | 2 ++ contrib/grpcplugins/action/plugin-marathon/Makefile | 2 ++ .../grpcplugins/action/plugin-npm-audit-parser/Makefile | 2 ++ contrib/grpcplugins/action/plugin-ssh-cmd/Makefile | 2 ++ contrib/grpcplugins/action/plugin-tmpl/Makefile | 2 ++ contrib/grpcplugins/action/plugin-venom/Makefile | 2 ++ 17 files changed, 42 insertions(+), 9 deletions(-) diff --git a/.build/go.mk b/.build/go.mk index f8f458fcbd..1415e70e82 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -28,10 +28,12 @@ mk_go_clean: # clean target directory ##### =====> Compile <===== ##### IS_TEST := $(filter test,$(MAKECMDGOALS)) -TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux freebsd)),$(shell go env GOOS))) -TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64)) +TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux openbsd freebsd)),$(shell go env GOOS))) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64 ppc64le)) BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) -CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES))) +OSARCHVALID = $(shell go tool dist list | grep -v '^darwin/arm'|grep -v '^darwin/386'|grep -v '^windows/386'|grep -v '^windows/arm'|grep -v '^openbsd/arm*'|grep -v '^openbsd/386'|grep -v '^freebsd/arm*'|grep -v '^freebsd/386') +IS_OS_ARCH_VALID = $(filter $(OS)/$(ARCH),$(OSARCHVALID)) +CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES)))) GOFILES = $(call get_recursive_files, '.') mk_go_build: diff --git a/.build/plugin.mk b/.build/plugin.mk index 6478950e8a..2c46ef827a 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -1,7 +1,7 @@ BINARIES_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH).yml, $(notdir $(TARGET_NAME)))) PLUGIN_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix .yml, $(notdir $(TARGET_NAME)))) -CROSS_COMPILED_PLUGIN_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES_CONF))) +CROSS_COMPILED_PLUGIN_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES_CONF)))) define PLUGIN_MANIFEST_BINARY os: %os% @@ -59,5 +59,8 @@ mk_plugin_publish: done; \ done +mk_plugin_package: + tar czf $(TARGET_DIST)/cds-$(TARGET_NAME)-all.tar.gz $(TARGET_DIST)/$(TARGET_NAME)* + clean: @rm -rf dist diff --git a/contrib/grpcplugins/action/Makefile b/contrib/grpcplugins/action/Makefile index b756367b11..89a1ab8555 100644 --- a/contrib/grpcplugins/action/Makefile +++ b/contrib/grpcplugins/action/Makefile @@ -23,10 +23,11 @@ build: $(TARGET_PLUGINS) package: @mkdir -p dist + @for P in $(ALL_PLUGINS); do \ + $(MAKE) package -C $$P; \ + done; @for PLU in $(ALL_PLUGINS); do \ - for F in `find $$PLU/dist -name "$$PLU*"`; do \ - mv $$F dist/; \ - done; \ + mv $$PLU/dist/*.tar.gz dist/; \ done; publish: diff --git a/contrib/grpcplugins/action/plugin-archive/Makefile b/contrib/grpcplugins/action/plugin-archive/Makefile index e3720f3f95..c5f8f300d7 100644 --- a/contrib/grpcplugins/action/plugin-archive/Makefile +++ b/contrib/grpcplugins/action/plugin-archive/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-clair/Makefile b/contrib/grpcplugins/action/plugin-clair/Makefile index 66fa87b1dc..a8f406c7ef 100644 --- a/contrib/grpcplugins/action/plugin-clair/Makefile +++ b/contrib/grpcplugins/action/plugin-clair/Makefile @@ -1,6 +1,6 @@ -TARGET_NAME = plugin-clair -TARGET_OS_EXCLUDED = freebsd +TARGET_NAME = plugin-clair +TARGET_OS_EXCLUDED = freebsd openbsd ##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### @@ -11,3 +11,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-clair/go.sum b/contrib/grpcplugins/action/plugin-clair/go.sum index 464dff4781..51c4aeb9ff 100644 --- a/contrib/grpcplugins/action/plugin-clair/go.sum +++ b/contrib/grpcplugins/action/plugin-clair/go.sum @@ -261,6 +261,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= diff --git a/contrib/grpcplugins/action/plugin-download/Makefile b/contrib/grpcplugins/action/plugin-download/Makefile index fd72dbc9ec..91c74b09f1 100644 --- a/contrib/grpcplugins/action/plugin-download/Makefile +++ b/contrib/grpcplugins/action/plugin-download/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-download/go.sum b/contrib/grpcplugins/action/plugin-download/go.sum index 481a9f459a..c46f584fd3 100644 --- a/contrib/grpcplugins/action/plugin-download/go.sum +++ b/contrib/grpcplugins/action/plugin-download/go.sum @@ -233,6 +233,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -249,6 +250,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile index b3119aa503..affa7c6316 100644 --- a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/go.sum b/contrib/grpcplugins/action/plugin-group-tmpl/go.sum index 481a9f459a..c46f584fd3 100644 --- a/contrib/grpcplugins/action/plugin-group-tmpl/go.sum +++ b/contrib/grpcplugins/action/plugin-group-tmpl/go.sum @@ -233,6 +233,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -249,6 +250,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile index 030d788f1b..6f67a520c9 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile +++ b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/go.sum b/contrib/grpcplugins/action/plugin-kafka-publish/go.sum index 461c052044..888eb26364 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/go.sum +++ b/contrib/grpcplugins/action/plugin-kafka-publish/go.sum @@ -329,6 +329,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7 h1:dMIPRDg6gi7CUp0Kj2+HxqJ5kTr1iAdzsXYIrLCNSmU= @@ -352,6 +353,7 @@ github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/contrib/grpcplugins/action/plugin-marathon/Makefile b/contrib/grpcplugins/action/plugin-marathon/Makefile index aff77c3a44..ab2710a760 100644 --- a/contrib/grpcplugins/action/plugin-marathon/Makefile +++ b/contrib/grpcplugins/action/plugin-marathon/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile index c9327c2478..e17c330d0d 100644 --- a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile index 0916ab96cf..1d184cd51c 100644 --- a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-tmpl/Makefile b/contrib/grpcplugins/action/plugin-tmpl/Makefile index 82150abd51..22aa246cd2 100644 --- a/contrib/grpcplugins/action/plugin-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-tmpl/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-venom/Makefile b/contrib/grpcplugins/action/plugin-venom/Makefile index babc1bae34..9a1bb36a87 100644 --- a/contrib/grpcplugins/action/plugin-venom/Makefile +++ b/contrib/grpcplugins/action/plugin-venom/Makefile @@ -10,3 +10,5 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. + +package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files From 9ac5001c2834c9f3171527b777762d3251b05752 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 15:54:10 +0200 Subject: [PATCH 08/12] fix: indent Signed-off-by: Yvonnick Esnault --- .build/core.mk | 12 +++---- .build/go.mk | 34 +++++++++---------- .build/plugin.mk | 6 ++-- .../grpcplugins/action/plugin-marathon/go.sum | 3 ++ 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.build/core.mk b/.build/core.mk index 4f935e131a..a6363578f9 100644 --- a/.build/core.mk +++ b/.build/core.mk @@ -1,9 +1,9 @@ -CI := $(if ${CI},${CI},0) -VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot) -CDS_VERSION := $(if ${CDS_VERSION},${CDS_VERSION},snapshot) -GITHASH := $(if ${GIT_HASH},${GIT_HASH},`git log -1 --format="%H"`) -BUILDTIME := `date "+%m/%d/%y-%H:%M:%S"` -UNAME := $(shell uname) +CI := $(if ${CI},${CI},0) +VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot) +CDS_VERSION := $(if ${CDS_VERSION},${CDS_VERSION},snapshot) +GITHASH := $(if ${GIT_HASH},${GIT_HASH},`git log -1 --format="%H"`) +BUILDTIME := `date "+%m/%d/%y-%H:%M:%S"` +UNAME := $(shell uname) UNAME_LOWERCASE := $(shell uname -s| tr A-Z a-z) .PHONY: help diff --git a/.build/go.mk b/.build/go.mk index 1415e70e82..e209b4f29b 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -1,12 +1,12 @@ -GO_BUILD = GOPRIVATE="${GO_PRIVATE}" CGO_ENABLED=0 go build -a -installsuffix cgo -GO_LIST = env GO111MODULE=on GOPRIVATE="${GO_PRIVATE}" go list -TEST_CMD = go test -v -timeout 600s -coverprofile=profile.coverprofile -TEST_C_CMD = go test -c -coverprofile=profile.coverprofile -TEST_RUN_ARGS = -test.v -test.timeout 600s -test.coverprofile=profile.coverprofile -LDFLAGS = -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION) -X github.com/ovh/cds/sdk.GOOS=$$GOOS -X github.com/ovh/cds/sdk.GOARCH=$$GOARCH -X github.com/ovh/cds/sdk.GITHASH=$(GITHASH) -X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME) -X github.com/ovh/cds/sdk.BINARY=$(TARGET_ENGINE) -X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)" -CURRENT_PACKAGE = $(shell $(GO_LIST)) -TARGET_DIST := ./dist -TARGET_RESULTS := ./results +GO_BUILD = GOPRIVATE="${GO_PRIVATE}" CGO_ENABLED=0 go build -a -installsuffix cgo +GO_LIST = env GO111MODULE=on GOPRIVATE="${GO_PRIVATE}" go list +TEST_CMD = go test -v -timeout 600s -coverprofile=profile.coverprofile +TEST_C_CMD = go test -c -coverprofile=profile.coverprofile +TEST_RUN_ARGS = -test.v -test.timeout 600s -test.coverprofile=profile.coverprofile +LDFLAGS = -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION) -X github.com/ovh/cds/sdk.GOOS=$$GOOS -X github.com/ovh/cds/sdk.GOARCH=$$GOARCH -X github.com/ovh/cds/sdk.GITHASH=$(GITHASH) -X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME) -X github.com/ovh/cds/sdk.BINARY=$(TARGET_ENGINE) -X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)" +CURRENT_PACKAGE = $(shell $(GO_LIST)) +TARGET_DIST := ./dist +TARGET_RESULTS := ./results ENABLE_CROSS_COMPILATION := true @@ -27,14 +27,14 @@ mk_go_clean: # clean target directory ##### =====> Compile <===== ##### -IS_TEST := $(filter test,$(MAKECMDGOALS)) -TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux openbsd freebsd)),$(shell go env GOOS))) -TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64 ppc64le)) -BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) -OSARCHVALID = $(shell go tool dist list | grep -v '^darwin/arm'|grep -v '^darwin/386'|grep -v '^windows/386'|grep -v '^windows/arm'|grep -v '^openbsd/arm*'|grep -v '^openbsd/386'|grep -v '^freebsd/arm*'|grep -v '^freebsd/386') -IS_OS_ARCH_VALID = $(filter $(OS)/$(ARCH),$(OSARCHVALID)) -CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES)))) -GOFILES = $(call get_recursive_files, '.') +IS_TEST := $(filter test,$(MAKECMDGOALS)) +TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux openbsd freebsd)),$(shell go env GOOS))) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64 ppc64le)) +BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) +OSARCHVALID = $(shell go tool dist list | grep -v '^darwin/arm'|grep -v '^darwin/386'|grep -v '^windows/386'|grep -v '^windows/arm'|grep -v '^openbsd/arm*'|grep -v '^openbsd/386'|grep -v '^freebsd/arm*'|grep -v '^freebsd/386') +IS_OS_ARCH_VALID = $(filter $(OS)/$(ARCH),$(OSARCHVALID)) +CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES)))) +GOFILES = $(call get_recursive_files, '.') mk_go_build: $(info *** mk_go_build) diff --git a/.build/plugin.mk b/.build/plugin.mk index 2c46ef827a..9ff80f67a0 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -1,7 +1,7 @@ -BINARIES_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH).yml, $(notdir $(TARGET_NAME)))) -PLUGIN_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix .yml, $(notdir $(TARGET_NAME)))) -CROSS_COMPILED_PLUGIN_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES_CONF)))) +BINARIES_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH).yml, $(notdir $(TARGET_NAME)))) +PLUGIN_CONF = $(addprefix $(TARGET_DIST)/, $(addsuffix .yml, $(notdir $(TARGET_NAME)))) +CROSS_COMPILED_PLUGIN_CONF = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(if $(IS_OS_ARCH_VALID), $(BINARIES_CONF)))) define PLUGIN_MANIFEST_BINARY os: %os% diff --git a/contrib/grpcplugins/action/plugin-marathon/go.sum b/contrib/grpcplugins/action/plugin-marathon/go.sum index d2fdc02d16..8431127a06 100644 --- a/contrib/grpcplugins/action/plugin-marathon/go.sum +++ b/contrib/grpcplugins/action/plugin-marathon/go.sum @@ -307,6 +307,7 @@ github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63 github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= github.com/imdario/mergo v0.0.0-20180119215619-163f41321a19/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/itsjamie/gin-cors v0.0.0-20160420130702-97b4a9da7933/go.mod h1:AYdLvrSBFloDBNt7Y8xkQ6gmhCODGl8CPikjyIOnNzA= github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee h1:AQ/QmCk6x8ECPpf2pkPtA4lyncEEBbs8VFnVXPYKhIs= @@ -321,6 +322,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= @@ -340,6 +342,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= From 6ebb4bab5ca0f910c315d08c0e2e8e3dfc531050 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 15:55:30 +0200 Subject: [PATCH 09/12] fix: indent Signed-off-by: Yvonnick Esnault --- .build/go.mk | 2 +- contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.build/go.mk b/.build/go.mk index e209b4f29b..88ea809190 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -1,4 +1,4 @@ -GO_BUILD = GOPRIVATE="${GO_PRIVATE}" CGO_ENABLED=0 go build -a -installsuffix cgo +GO_BUILD = GOPRIVATE="${GO_PRIVATE}" CGO_ENABLED=0 go build -a -installsuffix cgo GO_LIST = env GO111MODULE=on GOPRIVATE="${GO_PRIVATE}" go list TEST_CMD = go test -v -timeout 600s -coverprofile=profile.coverprofile TEST_C_CMD = go test -c -coverprofile=profile.coverprofile diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum index 481a9f459a..c46f584fd3 100644 --- a/contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.sum @@ -233,6 +233,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -249,6 +250,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= From 81e870d84ffcf65936cb7d10c9b57e9aaa8d1f28 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 16:40:29 +0200 Subject: [PATCH 10/12] fix(plugin): generate doc Signed-off-by: Yvonnick Esnault --- .build/go.mk | 6 +++--- .build/plugin.mk | 10 +++++++--- contrib/grpcplugins/action/plugin-ssh-cmd/go.sum | 2 ++ contrib/grpcplugins/action/plugin-tmpl/go.sum | 2 ++ contrib/grpcplugins/action/plugin-venom/go.sum | 2 ++ docs/build.sh | 4 ++-- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.build/go.mk b/.build/go.mk index 88ea809190..824cc5a292 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -27,9 +27,9 @@ mk_go_clean: # clean target directory ##### =====> Compile <===== ##### -IS_TEST := $(filter test,$(MAKECMDGOALS)) -TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux openbsd freebsd)),$(shell go env GOOS))) -TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64 ppc64le)) +IS_TEST := $(filter test,$(MAKECMDGOALS)) +TARGET_OS := $(filter-out $(TARGET_OS_EXCLUDED), $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), windows darwin linux openbsd freebsd)),$(shell go env GOOS))) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64 arm 386 arm64 ppc64le)) BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix -$(OS)-$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) OSARCHVALID = $(shell go tool dist list | grep -v '^darwin/arm'|grep -v '^darwin/386'|grep -v '^windows/386'|grep -v '^windows/arm'|grep -v '^openbsd/arm*'|grep -v '^openbsd/386'|grep -v '^freebsd/arm*'|grep -v '^freebsd/386') IS_OS_ARCH_VALID = $(filter $(OS)/$(ARCH),$(OSARCHVALID)) diff --git a/.build/plugin.mk b/.build/plugin.mk index 9ff80f67a0..bd13c5f754 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -53,9 +53,13 @@ mk_plugin_publish: @for GOOS in $(TARGET_OS); do \ for GOARCH in $(TARGET_ARCH); do \ EXTENSION=""; \ - if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ - echo "Updating plugin binary $(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION"; \ - cdsctl admin plugins binary-add $(TARGET_NAME) $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ + for V in $(OSARCHVALID); do \ + if test "$$GOOS/$$GOARCH" = "$$V"; then \ + if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \ + echo "Updating plugin binary $(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION"; \ + cdsctl admin plugins binary-add $(TARGET_NAME) $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml $(TARGET_DIST)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \ + fi; \ + done; \ done; \ done diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/go.sum b/contrib/grpcplugins/action/plugin-ssh-cmd/go.sum index 23f19c7707..f536a6b997 100644 --- a/contrib/grpcplugins/action/plugin-ssh-cmd/go.sum +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/go.sum @@ -233,6 +233,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -249,6 +250,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/contrib/grpcplugins/action/plugin-tmpl/go.sum b/contrib/grpcplugins/action/plugin-tmpl/go.sum index 481a9f459a..c46f584fd3 100644 --- a/contrib/grpcplugins/action/plugin-tmpl/go.sum +++ b/contrib/grpcplugins/action/plugin-tmpl/go.sum @@ -233,6 +233,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -249,6 +250,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/contrib/grpcplugins/action/plugin-venom/go.sum b/contrib/grpcplugins/action/plugin-venom/go.sum index 23b35b5494..ad49fef913 100644 --- a/contrib/grpcplugins/action/plugin-venom/go.sum +++ b/contrib/grpcplugins/action/plugin-venom/go.sum @@ -247,6 +247,7 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= @@ -264,6 +265,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= diff --git a/docs/build.sh b/docs/build.sh index 0b530ae63c..50d545ea2f 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -34,13 +34,13 @@ function generatePluginsDocumentation { pluginName=${filename/.yml/} OLD=`pwd` - PLUGIN_FILE="$OLD/content/docs/actions/plugin-${pluginName}.md" + PLUGIN_FILE="$OLD/content/docs/actions/${pluginName}.md" echo "generate ${PLUGIN_FILE}" cat << EOF > ${PLUGIN_FILE} --- -title: "plugin-${pluginName}" +title: "${pluginName}" card: name: plugin --- From 07d19372387fd12a62724ce17a39bb55a9194f16 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 16:43:26 +0200 Subject: [PATCH 11/12] fix: doc Signed-off-by: Yvonnick Esnault --- docs/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build.sh b/docs/build.sh index 50d545ea2f..6c46df272c 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -28,7 +28,7 @@ EOF } function generatePluginsDocumentation { - for plugin in `ls ../contrib/grpcplugins/action/*/*.yml`; do + for plugin in `ls ../contrib/grpcplugins/action/plugin-*/*.yml`; do filename=$(basename "$plugin") pluginName=${filename/.yml/} From 0dbc2e60a97120647f37418c31f38b38472a1658 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 4 Jun 2020 18:44:17 +0200 Subject: [PATCH 12/12] chore: make test on plugin Signed-off-by: Yvonnick Esnault --- .build/go.mk | 60 ++++++------------- .build/plugin.mk | 3 - contrib/grpcplugins/action/Makefile | 10 +++- .../action/plugin-archive/Makefile | 4 ++ .../grpcplugins/action/plugin-archive/go.mod | 4 +- .../grpcplugins/action/plugin-archive/go.sum | 16 +++++ .../grpcplugins/action/plugin-clair/Makefile | 5 ++ .../grpcplugins/action/plugin-clair/go.mod | 2 +- .../action/plugin-download/Makefile | 5 ++ .../grpcplugins/action/plugin-download/go.mod | 2 +- .../action/plugin-group-tmpl/Makefile | 4 ++ .../action/plugin-group-tmpl/go.mod | 2 +- .../action/plugin-kafka-publish/Makefile | 4 ++ .../action/plugin-kafka-publish/go.mod | 4 +- .../action/plugin-kafka-publish/go.sum | 5 ++ .../kafkapublisher/chunks_test.go | 4 +- .../action/plugin-marathon/Makefile | 4 ++ .../grpcplugins/action/plugin-marathon/go.mod | 2 +- .../grpcplugins/action/plugin-marathon/go.sum | 1 + .../action/plugin-marathon/plugin_test.go | 6 +- .../action/plugin-npm-audit-parser/Makefile | 5 ++ .../action/plugin-npm-audit-parser/go.mod | 2 +- .../action/plugin-ssh-cmd/Makefile | 5 ++ .../grpcplugins/action/plugin-ssh-cmd/go.mod | 2 +- .../grpcplugins/action/plugin-tmpl/Makefile | 4 ++ contrib/grpcplugins/action/plugin-tmpl/go.mod | 2 +- .../grpcplugins/action/plugin-venom/Makefile | 4 ++ .../grpcplugins/action/plugin-venom/go.mod | 2 +- .../grpcplugins/action/plugin-venom/go.sum | 1 + go.mod | 2 +- sdk/interpolate/go.mod | 2 +- sdk/izanami/go.mod | 2 +- tools/smtpmock/go.mod | 2 +- 33 files changed, 114 insertions(+), 68 deletions(-) diff --git a/.build/go.mk b/.build/go.mk index 824cc5a292..987be8d765 100644 --- a/.build/go.mk +++ b/.build/go.mk @@ -6,7 +6,7 @@ TEST_RUN_ARGS = -test.v -test.timeout 600s -test.coverprofile=profile LDFLAGS = -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION) -X github.com/ovh/cds/sdk.GOOS=$$GOOS -X github.com/ovh/cds/sdk.GOARCH=$$GOARCH -X github.com/ovh/cds/sdk.GITHASH=$(GITHASH) -X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME) -X github.com/ovh/cds/sdk.BINARY=$(TARGET_ENGINE) -X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)" CURRENT_PACKAGE = $(shell $(GO_LIST)) TARGET_DIST := ./dist -TARGET_RESULTS := ./results +TARGET_RESULTS := ./dist/test-results ENABLE_CROSS_COMPILATION := true @@ -89,14 +89,18 @@ GO_COBERTURA = ${GOPATH}/bin/gocover-cobertura $(GO_COBERTURA): go get -u github.com/t-yuki/gocover-cobertura -mk_go_test: $(GO_COV_MERGE) $(GO_COBERTURA) $(GOFILES) $(TARGET_RESULTS) $(TESTPKGS_RESULTS)# Run tests +GO_XUTOOLS = ${GOPATH}/bin/xutools +$(GO_XUTOOLS): + go get -u github.com/richardlt/xutools + +mk_go_test: $(GO_COV_MERGE) $(GO_XUTOOLS) $(GO_COBERTURA) $(GOFILES) $(TARGET_RESULTS) $(TESTPKGS_RESULTS) # Run tests @echo "Generating unit tests coverage..." @$(GO_COV_MERGE) `find ./ -name "*.coverprofile"` > $(TARGET_RESULTS)/cover.out @$(GO_COBERTURA) < $(TARGET_RESULTS)/cover.out > $(TARGET_RESULTS)/coverage.xml @go tool cover -html=$(TARGET_RESULTS)/cover.out -o=$(TARGET_RESULTS)/cover.html - @NB=$$(grep -c "^FAIL" `find . -type f -name "tests.log"`|grep -v ':0'|wc -l); echo "tests failed $$NB" && exit $$NB + @NB=$$(grep -c "^FAIL" `find . -type f -name "tests.log"`|grep -v ':0'|grep -v '^0'|wc -l); echo "tests failed $$NB" && exit $$NB -mk_go_test-xunit: $(GO_GOJUNIT) $(TARGET_RESULTS) # Generate test with xunit report +mk_go_test-xunit: $(GO_GOJUNIT) $(GOFILES) $(TARGET_RESULTS) # Generate test with xunit report @echo "Generating xUnit Report..." @for TST in `find . -name "tests.log"`; do \ if [ -s $$TST ]; then \ @@ -121,46 +125,16 @@ mk_go_test-xunit: $(GO_GOJUNIT) $(TARGET_RESULTS) # Generate test with xunit rep echo "Ignoring empty file \t\t$$TST"; \ fi; \ done; \ - for XML in `find . -name "tests.log.tests-results.xml"`; do \ - if [ "$$XML" = "./tests.log.tests-results.xml" ]; then \ - PWD=`pwd`; \ - mv $$XML $(TARGET_RESULTS)/`basename $(PWD)`.tests-results.xml; \ - else \ - mv $$XML $(TARGET_RESULTS)/`echo $$XML | sed 's|./||' | sed 's|/|_|g' | sed 's|_tests.log||'`; \ - fi; \ - done; \ - rm -f $(TARGET_RESULTS)/report; \ - for XML in `find . -name "*.tests-results.xml"`; do \ - if [ -s $$XML ]; then \ - if grep -q 'testsuite' $$XML; then \ - echo "Generating report: " $$XML; \ - echo "`xmllint --xpath "//testsuite/@name" $$XML | sed 's/name=//' | sed 's/"//g'`" \ - "`xmllint --xpath "//testsuite/@tests" $$XML | sed 's/tests=//' | sed 's/"//g'` Tests :" \ - "`xmllint --xpath "//testsuite/@errors" $$XML 2>/dev/null | sed 's/errors=//' | sed 's/"//g'` Errors ;"\ - "`xmllint --xpath "//testsuite/@failures" $$XML 2>/dev/null | sed 's/failures=//' | sed 's/"//g'` Failures;" \ - "`xmllint --xpath "//testsuite/@skip" $$XML 2>/dev/null | sed 's/skip=//' | sed 's/"//g'` Skipped;" \ - >> $(TARGET_RESULTS)/report; \ - fi; \ - fi; \ - done; \ - if [ -e $(TARGET_RESULTS)/report ]; then \ - cat $(TARGET_RESULTS)/report; \ + xutools pretty --show-failures $(TARGET_DIST)/*.xml > $(TARGET_DIST)/report; \ + xutools sort-duration $(TARGET_DIST)/*.xml > $(TARGET_DIST)/duration; \ + if [ -e $(TARGET_DIST)/report ]; then \ + echo "Report:"; \ + cat $(TARGET_DIST)/report; \ fi; \ - echo "#########################"; \ - for XML in `find . -name "*.tests-results.xml"`; do \ - if [ -s $$XML ]; then \ - if grep -q 'errors' $$XML && grep -q 'testsuite' $$XML; then \ - if [ "`xmllint --xpath "//testsuite/@errors" $$XML | sed 's/errors=//' | sed 's/"//g'`" -gt "0" ]; then \ - echo " $$XML : Tests failed"; \ - fi; \ - fi; \ - if grep -q 'failures' $$XML && grep -q 'testsuite' $$XML $$XML; then \ - if [ "`xmllint --xpath "//testsuite/@failures" $$XML | sed 's/failures=//' | sed 's/"//g'`" -gt "0" ]; then \ - echo " $$XML : Tests failed"; \ - fi; \ - fi; \ - fi; \ - done; \ + if [ -e $(TARGET_DIST)/duration ]; then \ + echo "Max duration:"; \ + cat $(TARGET_DIST)/duration; \ + fi;\ if [ -e $(TARGET_RESULTS)/fail ]; then \ echo "#########################"; \ echo "ERROR: Test compilation failure"; \ diff --git a/.build/plugin.mk b/.build/plugin.mk index bd13c5f754..67b230b93e 100644 --- a/.build/plugin.mk +++ b/.build/plugin.mk @@ -65,6 +65,3 @@ mk_plugin_publish: mk_plugin_package: tar czf $(TARGET_DIST)/cds-$(TARGET_NAME)-all.tar.gz $(TARGET_DIST)/$(TARGET_NAME)* - -clean: - @rm -rf dist diff --git a/contrib/grpcplugins/action/Makefile b/contrib/grpcplugins/action/Makefile index 89a1ab8555..815fe04b1b 100644 --- a/contrib/grpcplugins/action/Makefile +++ b/contrib/grpcplugins/action/Makefile @@ -1,6 +1,7 @@ ##### =====> Commands <===== ##### include ../../../.build/core.mk +include ../../../.build/go.mk DIRS := `ls -d plugin-* | cut -f1 -d'/'` ALL_PLUGINS := $(if ${TARGET_NAME},${TARGET_NAME}, $(filter-out $(TARGET_DIST), $(shell for plugin in $(DIRS); do echo $(basename "$$plugin"); done))) @@ -19,7 +20,7 @@ $(TARGET_PLUGINS): $(TARGET_DIST) build: $(TARGET_PLUGINS) -.PHONY: dist +.PHONY: dist test package publish clean package: @mkdir -p dist @@ -30,12 +31,17 @@ package: mv $$PLU/dist/*.tar.gz dist/; \ done; +test: + @for P in $(ALL_PLUGINS); do \ + $(MAKE) test -C $$P; \ + done; + publish: @for P in $(ALL_PLUGINS); do \ $(MAKE) publish -C $$P; \ done; -clean: +clean: mk_go_clean ## clean binary and tests results @rm -rf $(TARGET_DIST) @for P in $(ALL_PLUGINS); do \ $(MAKE) clean -C $$P; \ diff --git a/contrib/grpcplugins/action/plugin-archive/Makefile b/contrib/grpcplugins/action/plugin-archive/Makefile index c5f8f300d7..98b7ba80e2 100644 --- a/contrib/grpcplugins/action/plugin-archive/Makefile +++ b/contrib/grpcplugins/action/plugin-archive/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-archive/go.mod b/contrib/grpcplugins/action/plugin-archive/go.mod index 1e6e83c11b..1e4e9a0843 100644 --- a/contrib/grpcplugins/action/plugin-archive/go.mod +++ b/contrib/grpcplugins/action/plugin-archive/go.mod @@ -2,14 +2,16 @@ module github.com/ovh/cds/contrib/grpcplugins/action/archive replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/frankban/quicktest v1.7.2 // indirect github.com/golang/protobuf v1.3.2 github.com/golang/snappy v0.0.1 // indirect github.com/mholt/archiver v3.1.1+incompatible github.com/ovh/cds v0.0.0-00010101000000-000000000000 + github.com/richardlt/xutools v0.0.0-20200603155020-1bd33a66ce36 // indirect github.com/stretchr/testify v1.5.1 ) diff --git a/contrib/grpcplugins/action/plugin-archive/go.sum b/contrib/grpcplugins/action/plugin-archive/go.sum index 0bb0232c5e..937e80fb4f 100644 --- a/contrib/grpcplugins/action/plugin-archive/go.sum +++ b/contrib/grpcplugins/action/plugin-archive/go.sum @@ -71,6 +71,10 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/dancannon/gorethink v4.0.0+incompatible/go.mod h1:BLvkat9KmZc1efyYwhz3WnybhRZtgF1K929FD8z1avU= github.com/danieljoos/wincred v1.0.1/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= @@ -388,6 +392,8 @@ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v0.0.0-20160930220758-4d0e916071f6 h1:V8AT/I4KmIDRfObq0yBUvbD4DeaYmQY9GhC5sKl24Mo= github.com/pkg/sftp v0.0.0-20160930220758-4d0e916071f6/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -426,8 +432,12 @@ github.com/quay/clair/v2 v2.1.1/go.mod h1:W98TX5hlrJA0+InaAtyM0R7x8e5SVonTSTj/Pj github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remind101/migrate v0.0.0-20160423010909-d22d647232c2/go.mod h1:rhSvwcijY9wfmrBYrfCvapX8/xOTV46NAUjBRgUyJqc= +github.com/richardlt/xutools v0.0.0-20200603155020-1bd33a66ce36 h1:xYikgHyoggR5fnPz4JC1jX0gTBxzmUTkfu+0e8gIjUk= +github.com/richardlt/xutools v0.0.0-20200603155020-1bd33a66ce36/go.mod h1:qNpOqg5pOg9BNZrLCEi6aBx3q3Tm13D6mE0h3q22oYw= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rubenv/sql-migrate v0.0.0-20160620083229-6f4757563362/go.mod h1:WS0rl9eEliYI8DPnr3TOwz4439pay+qNgzJoVya/DmY= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sclevine/agouti v0.0.0-20171003013254-8cf0313221cb/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= @@ -436,6 +446,8 @@ github.com/sethgrid/pester v0.0.0-20171127025028-760f8913c048/go.mod h1:Ad7IjTpv github.com/sguiheux/go-coverage v0.0.0-20190710153556-287b082a7197 h1:qu90yDtRE5WEfRT5mn9v0Xz9RaopLguhbPwZKx4dHq8= github.com/sguiheux/go-coverage v0.0.0-20190710153556-287b082a7197/go.mod h1:0hhKrsUsoT7yvxwNGKa+TSYNA26DNWMqReeZEQq/9FI= github.com/shirou/gopsutil v0.0.0-20170406131756-e49a95f3d5f8/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v0.11.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= @@ -477,6 +489,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tebeka/go2xunit v1.4.10/go.mod h1:wmc9jKT7KlU4QLU6DNTaIXNnYNOjKKNlp6mjOS0UrqY= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0= @@ -491,7 +504,10 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY github.com/ulikunitz/xz v0.5.4/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= +github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/vbatts/tar-split v0.10.2/go.mod h1:LEuURwDEiWjRjwu46yU3KVGuUdVv/dcnpcEPSzR8z6g= github.com/vmware/govmomi v0.0.0-20170817040329-d7e841db6909/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/whilp/git-urls v0.0.0-20160530060445-31bac0d230fa/go.mod h1:2rx5KE5FLD0HRfkkpyn8JwbVLBdhgeiOb2D2D9LLKM4= diff --git a/contrib/grpcplugins/action/plugin-clair/Makefile b/contrib/grpcplugins/action/plugin-clair/Makefile index a8f406c7ef..fe70950012 100644 --- a/contrib/grpcplugins/action/plugin-clair/Makefile +++ b/contrib/grpcplugins/action/plugin-clair/Makefile @@ -10,6 +10,11 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: ## run unit tests + @echo "No test for $(TARGET_NAME)" + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-clair/go.mod b/contrib/grpcplugins/action/plugin-clair/go.mod index 81bca096e1..e0107a60c2 100644 --- a/contrib/grpcplugins/action/plugin-clair/go.mod +++ b/contrib/grpcplugins/action/plugin-clair/go.mod @@ -1,6 +1,6 @@ module github.com/ovh/cds/contrib/grpcplugins/action/clair -go 1.13 +go 1.14 replace github.com/ovh/cds => ../../../../ diff --git a/contrib/grpcplugins/action/plugin-download/Makefile b/contrib/grpcplugins/action/plugin-download/Makefile index 91c74b09f1..2eaefa777b 100644 --- a/contrib/grpcplugins/action/plugin-download/Makefile +++ b/contrib/grpcplugins/action/plugin-download/Makefile @@ -9,6 +9,11 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: ## run unit tests + @echo "No test for $(TARGET_NAME)" + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-download/go.mod b/contrib/grpcplugins/action/plugin-download/go.mod index 3852cda00d..064d747dea 100644 --- a/contrib/grpcplugins/action/plugin-download/go.mod +++ b/contrib/grpcplugins/action/plugin-download/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/download replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/golang/protobuf v1.3.2 diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile index affa7c6316..7096cabf77 100644 --- a/contrib/grpcplugins/action/plugin-group-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-group-tmpl/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-group-tmpl/go.mod b/contrib/grpcplugins/action/plugin-group-tmpl/go.mod index a21789bd73..88bf527af3 100644 --- a/contrib/grpcplugins/action/plugin-group-tmpl/go.mod +++ b/contrib/grpcplugins/action/plugin-group-tmpl/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/group-tmpl replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/golang/protobuf v1.3.2 diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile index 6f67a520c9..7690df0fda 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/Makefile +++ b/contrib/grpcplugins/action/plugin-kafka-publish/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/go.mod b/contrib/grpcplugins/action/plugin-kafka-publish/go.mod index 30d4ba3848..e0b2851491 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/go.mod +++ b/contrib/grpcplugins/action/plugin-kafka-publish/go.mod @@ -2,7 +2,9 @@ module github.com/ovh/cds/contrib/grpcplugins/action/kafka-publish replace github.com/ovh/cds => ../../../../ -go 1.13 +replace github.com/go-gorp/gorp => github.com/yesnault/gorp v2.0.1-0.20200325154225-2dc6d8c2da37+incompatible + +go 1.14 require ( github.com/Shopify/sarama v1.24.1 diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/go.sum b/contrib/grpcplugins/action/plugin-kafka-publish/go.sum index 888eb26364..8e79bce6f4 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/go.sum +++ b/contrib/grpcplugins/action/plugin-kafka-publish/go.sum @@ -610,6 +610,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tebeka/go2xunit v1.4.10/go.mod h1:wmc9jKT7KlU4QLU6DNTaIXNnYNOjKKNlp6mjOS0UrqY= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0= @@ -645,6 +646,8 @@ github.com/yesnault/go-imap v0.0.0-20160710142244-eb9bbb66bd7b/go.mod h1:LH8s5iF github.com/yesnault/go-toml v0.0.0-20170920144045-9a5282f85277/go.mod h1:SsMrIuedaKvK8GekjwjVv8gMnHNAuvoINpKCARzdsEQ= github.com/yesnault/go-toml v0.0.0-20191205182532-f5ef6cee7945/go.mod h1:SsMrIuedaKvK8GekjwjVv8gMnHNAuvoINpKCARzdsEQ= github.com/yesnault/gorp v2.0.0+incompatible/go.mod h1:7nhqtxBPZoPXx86SqUzP/OFLd8prnhkydPk51uJthQc= +github.com/yesnault/gorp v2.0.1-0.20200325154225-2dc6d8c2da37+incompatible h1:8M+L4IKModOdc0ZsH0kHJiqZ7CmWF4yH8yy4InZxKyY= +github.com/yesnault/gorp v2.0.1-0.20200325154225-2dc6d8c2da37+incompatible/go.mod h1:7nhqtxBPZoPXx86SqUzP/OFLd8prnhkydPk51uJthQc= github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed h1:I1vcLHWU9m30rA90rMrKPu0eD3NDA4FBlkB8WMaDyUw= github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed/go.mod h1:9w6KSdZh23UWqOywWsRLUcJUrUNjRh4Ql3z9uVgnSP4= github.com/yuin/gopher-lua v0.0.0-20170901023928-8c2befcd3908 h1:D1Gc3nOtLEadaHIZD98eX2ABnEi0OW7UZGogFWERsFI= @@ -669,6 +672,7 @@ golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 h1:bselrhR0Or1vomJZC8ZIjWtbDmn9OYFLX5Ik9alpJpE= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -696,6 +700,7 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw= diff --git a/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go index e60e6b38ac..df20571416 100644 --- a/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go +++ b/contrib/grpcplugins/action/plugin-kafka-publish/kafkapublisher/chunks_test.go @@ -1,7 +1,6 @@ package kafkapublisher import ( - "encoding/base64" "io/ioutil" "testing" @@ -18,13 +17,12 @@ func TestKafkaMessages(t *testing.T) { msgs, err := KafkaMessages(chunks) test.NoError(t, err) - filenameB64 := base64.StdEncoding.EncodeToString([]byte("chunks.go")) var chunks2 shredder.Chunks for i, msg := range msgs { c, err := ReadBytes(msg) assert.NoError(t, err) assert.NotNil(t, c) - assert.Equal(t, filenameB64, c.Ctx.UUID) + assert.Equal(t, "&filename=chunks.go", c.Ctx.UUID) assert.Equal(t, shredder.FileContentType, c.Ctx.ContentType) assert.Equal(t, 7, c.Ctx.ChunksNumber) assert.Equal(t, i, c.Offset) diff --git a/contrib/grpcplugins/action/plugin-marathon/Makefile b/contrib/grpcplugins/action/plugin-marathon/Makefile index ab2710a760..3e774dd424 100644 --- a/contrib/grpcplugins/action/plugin-marathon/Makefile +++ b/contrib/grpcplugins/action/plugin-marathon/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-marathon/go.mod b/contrib/grpcplugins/action/plugin-marathon/go.mod index 1d1f3f9ef5..7752c45747 100644 --- a/contrib/grpcplugins/action/plugin-marathon/go.mod +++ b/contrib/grpcplugins/action/plugin-marathon/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/marathon replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect diff --git a/contrib/grpcplugins/action/plugin-marathon/go.sum b/contrib/grpcplugins/action/plugin-marathon/go.sum index 8431127a06..10ec6e0b6e 100644 --- a/contrib/grpcplugins/action/plugin-marathon/go.sum +++ b/contrib/grpcplugins/action/plugin-marathon/go.sum @@ -591,6 +591,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tebeka/go2xunit v1.4.10/go.mod h1:wmc9jKT7KlU4QLU6DNTaIXNnYNOjKKNlp6mjOS0UrqY= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0= diff --git a/contrib/grpcplugins/action/plugin-marathon/plugin_test.go b/contrib/grpcplugins/action/plugin-marathon/plugin_test.go index b545ec9290..61a7ca1721 100644 --- a/contrib/grpcplugins/action/plugin-marathon/plugin_test.go +++ b/contrib/grpcplugins/action/plugin-marathon/plugin_test.go @@ -9,7 +9,7 @@ import ( "github.com/ovh/cds/sdk/grpcplugin/actionplugin" ) -func Test_parseEmptyMarathonFileShouldactionplugin.Fail(t *testing.T) { +func Test_parseEmptyMarathonFileShouldactionpluginFail(t *testing.T) { filepath := "./fixtures/marathon1.json" app, err := parseApplicationConfigFile(filepath) assert.Nil(t, app) @@ -17,7 +17,7 @@ func Test_parseEmptyMarathonFileShouldactionplugin.Fail(t *testing.T) { t.Log(err.Error()) } -func Test_parseInvalidJSONFileShouldactionplugin.Fail(t *testing.T) { +func Test_parseInvalidJSONFileShouldactionpluginFail(t *testing.T) { filepath := "./fixtures/marathon2.json" app, err := parseApplicationConfigFile(filepath) assert.Nil(t, app) @@ -25,7 +25,7 @@ func Test_parseInvalidJSONFileShouldactionplugin.Fail(t *testing.T) { t.Log(err.Error()) } -func Test_parseInvalidMarathonFileShouldactionplugin.Fail(t *testing.T) { +func Test_parseInvalidMarathonFileShouldactionpluginFail(t *testing.T) { filepath := "./fixtures/marathon3.json" app, err := parseApplicationConfigFile(filepath) assert.Nil(t, app) diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile index e17c330d0d..d25a2079cf 100644 --- a/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/Makefile @@ -9,6 +9,11 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: ## run unit tests + @echo "No test for $(TARGET_NAME)" + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod index 037affba07..4183c73813 100644 --- a/contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod +++ b/contrib/grpcplugins/action/plugin-npm-audit-parser/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/npm-audit-parser replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/golang/protobuf v1.3.2 diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile index 1d184cd51c..5b88f43ed8 100644 --- a/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/Makefile @@ -9,6 +9,11 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: ## run unit tests + @echo "No test for $(TARGET_NAME)" + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-ssh-cmd/go.mod b/contrib/grpcplugins/action/plugin-ssh-cmd/go.mod index e08df99bd3..0370a453a9 100644 --- a/contrib/grpcplugins/action/plugin-ssh-cmd/go.mod +++ b/contrib/grpcplugins/action/plugin-ssh-cmd/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/ssh-cmd replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/golang/protobuf v1.3.2 diff --git a/contrib/grpcplugins/action/plugin-tmpl/Makefile b/contrib/grpcplugins/action/plugin-tmpl/Makefile index 22aa246cd2..4027a865ce 100644 --- a/contrib/grpcplugins/action/plugin-tmpl/Makefile +++ b/contrib/grpcplugins/action/plugin-tmpl/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-tmpl/go.mod b/contrib/grpcplugins/action/plugin-tmpl/go.mod index 299be3c1f4..8896ff5f7a 100644 --- a/contrib/grpcplugins/action/plugin-tmpl/go.mod +++ b/contrib/grpcplugins/action/plugin-tmpl/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/tmpl replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/golang/protobuf v1.3.2 diff --git a/contrib/grpcplugins/action/plugin-venom/Makefile b/contrib/grpcplugins/action/plugin-venom/Makefile index 9a1bb36a87..7a922e1213 100644 --- a/contrib/grpcplugins/action/plugin-venom/Makefile +++ b/contrib/grpcplugins/action/plugin-venom/Makefile @@ -9,6 +9,10 @@ include ../../../../.build/plugin.mk build: mk_go_build_plugin ## build action plugin and prepare configuration for publish +clean: mk_go_clean ## clean binary and tests results + +test: mk_go_test ## run unit tests + publish: mk_plugin_publish ## publish the plugin on CDS. This use your cdsctl default context and commands cdsctl admin plugins import / binary-add. package: mk_plugin_package ## prepare the tar.gz file, with all binaries / conf files diff --git a/contrib/grpcplugins/action/plugin-venom/go.mod b/contrib/grpcplugins/action/plugin-venom/go.mod index 5f544c9331..aa6c70fd39 100644 --- a/contrib/grpcplugins/action/plugin-venom/go.mod +++ b/contrib/grpcplugins/action/plugin-venom/go.mod @@ -2,7 +2,7 @@ module github.com/ovh/cds/contrib/grpcplugins/action/venom replace github.com/ovh/cds => ../../../../ -go 1.13 +go 1.14 require ( github.com/bsm/sarama-cluster v2.1.15+incompatible // indirect diff --git a/contrib/grpcplugins/action/plugin-venom/go.sum b/contrib/grpcplugins/action/plugin-venom/go.sum index ad49fef913..f394ed5c19 100644 --- a/contrib/grpcplugins/action/plugin-venom/go.sum +++ b/contrib/grpcplugins/action/plugin-venom/go.sum @@ -502,6 +502,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tebeka/go2xunit v1.4.10/go.mod h1:wmc9jKT7KlU4QLU6DNTaIXNnYNOjKKNlp6mjOS0UrqY= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0= diff --git a/go.mod b/go.mod index 47ab8bd13b..b2ce8943c6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ovh/cds -go 1.13 +go 1.14 require ( cloud.google.com/go v0.44.3 // indirect diff --git a/sdk/interpolate/go.mod b/sdk/interpolate/go.mod index 5faf34b277..7bad031fca 100644 --- a/sdk/interpolate/go.mod +++ b/sdk/interpolate/go.mod @@ -6,4 +6,4 @@ require ( github.com/stretchr/testify v1.5.1 ) -go 1.13 +go 1.14 diff --git a/sdk/izanami/go.mod b/sdk/izanami/go.mod index 0377a39b1a..30f45e341c 100644 --- a/sdk/izanami/go.mod +++ b/sdk/izanami/go.mod @@ -1,5 +1,5 @@ module github.com/ovh/cds/sdk/izanami -go 1.13 +go 1.14 require github.com/facebookgo/httpcontrol v0.0.0-20150708234001-ccde4420e1fe diff --git a/tools/smtpmock/go.mod b/tools/smtpmock/go.mod index 6a92c54cb1..fd852b58c6 100644 --- a/tools/smtpmock/go.mod +++ b/tools/smtpmock/go.mod @@ -1,6 +1,6 @@ module github.com/ovh/cds/tools/smtpmock -go 1.13 +go 1.14 require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible