From 48f80f6024696d3a37c0ffd80f3e2f843f74398e Mon Sep 17 00:00:00 2001 From: Anuj Chaudhari Date: Thu, 30 Mar 2023 00:17:11 -0700 Subject: [PATCH] Update plugin-tooling.mk, Update builder plugin to bootstrap using plugin-tooling --- cmd/plugin/builder/init.go | 2 +- .../template/plugintemplates/Makefile.tmpl | 78 +------ .../template/plugintemplates/main.go.tmpl | 2 + .../plugintemplates/plugin-tooling.mk.tmpl | 190 ++++++++++++++++++ .../template/plugintemplates/templates.go | 5 + cmd/plugin/builder/template/root.go | 6 + cmd/plugin/builder/template/target.go | 1 + plugin-tooling.mk | 50 +++-- 8 files changed, 239 insertions(+), 95 deletions(-) create mode 100644 cmd/plugin/builder/template/plugintemplates/plugin-tooling.mk.tmpl diff --git a/cmd/plugin/builder/init.go b/cmd/plugin/builder/init.go index e9a704647..415401dd1 100644 --- a/cmd/plugin/builder/init.go +++ b/cmd/plugin/builder/init.go @@ -25,7 +25,7 @@ var ( // NewInitCmd initializes a repository. func NewInitCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "init PLUGIN_NAME", + Use: "init REPO_NAME", Short: "Initialize a new plugin repository", Long: desc, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/plugin/builder/template/plugintemplates/Makefile.tmpl b/cmd/plugin/builder/template/plugintemplates/Makefile.tmpl index 996d4e49b..42a9b08fd 100644 --- a/cmd/plugin/builder/template/plugintemplates/Makefile.tmpl +++ b/cmd/plugin/builder/template/plugintemplates/Makefile.tmpl @@ -1,91 +1,23 @@ ROOT_DIR_RELATIVE := . include $(ROOT_DIR_RELATIVE)/common.mk - -BUILD_VERSION ?= $(shell cat BUILD_VERSION) -BUILD_SHA ?= $(shell git rev-parse --short HEAD) -BUILD_DATE ?= $(shell date -u +"%Y-%m-%d") - -GOOS ?= $(shell go env GOOS) -GOARCH ?= $(shell go env GOARCH) -GOHOSTOS ?= $(shell go env GOHOSTOS) -GOHOSTARCH ?= $(shell go env GOHOSTARCH) - -LD_FLAGS = -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=$(BUILD_DATE)' -LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=$(BUILD_SHA)' -LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=$(BUILD_VERSION)' +include $(ROOT_DIR_RELATIVE)/plugin-tooling.mk TOOLS_DIR := tools TOOLS_BIN_DIR := $(TOOLS_DIR)/bin GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint GOLANGCI_LINT_VERSION := 1.49.0 -GO_SRCS := $(call rwildcard,.,*.go) - -ARTIFACTS_DIR ?= ./artifacts -TANZU_PLUGIN_PUBLISH_PATH ?= $(ARTIFACTS_DIR)/published - -# Name of Tanzu CLI binary -TZBIN ?= tz - -# Add list of plugins separated by space -PLUGINS ?= "" - -# Add supported OS-ARCHITECTURE combinations here -ENVS ?= linux-amd64 windows-amd64 darwin-amd64 - -BUILD_JOBS := $(addprefix build-,${ENVS}) -PUBLISH_JOBS := $(addprefix publish-,${ENVS}) - -go.mod go.sum: $(GO_SRCS) - go mod download - go mod tidy - -.PHONY: build-local -build-local: ## Build the plugin - $(TZBIN) builder cli compile --version $(BUILD_VERSION) --ldflags "$(LD_FLAGS)" --path ./cmd/plugin --target local --artifacts artifacts/${GOHOSTOS}/${GOHOSTARCH}/cli - -.PHONY: build -build: $(BUILD_JOBS) $(PUBLISH_JOBS) ## Build the plugin - -.PHONY: build-% -build-%: - $(eval ARCH = $(word 2,$(subst -, ,$*))) - $(eval OS = $(word 1,$(subst -, ,$*))) - $(TZBIN) builder cli compile --version $(BUILD_VERSION) --ldflags "$(LD_FLAGS)" --path ./cmd/plugin --artifacts artifacts/${OS}/${ARCH}/cli --target ${OS}_${ARCH} - -publish-local: ## Publish the plugin to generate discovery and distribution directory for local OS_ARCH - $(TZBIN) builder publish --type local --plugins "$(PLUGINS)" --version $(BUILD_VERSION) --os-arch "${GOHOSTOS}-${GOHOSTARCH}" --local-output-discovery-dir "$(TANZU_PLUGIN_PUBLISH_PATH)/${GOHOSTOS}-${GOHOSTARCH}/discovery/standalone" --local-output-distribution-dir "$(TANZU_PLUGIN_PUBLISH_PATH)/${GOHOSTOS}-${GOHOSTARCH}/distribution" --input-artifact-dir $(ARTIFACTS_DIR) - -.PHONY: publish -publish: $(PUBLISH_JOBS) ## Publish the plugin to generate discovery and distribution directory - -.PHONY: publish-% -publish-%: - $(eval ARCH = $(word 2,$(subst -, ,$*))) - $(eval OS = $(word 1,$(subst -, ,$*))) - $(TZBIN) builder publish --type local --plugins "$(PLUGINS)" --version $(BUILD_VERSION) --os-arch "${OS}-${ARCH}" --local-output-discovery-dir "$(TANZU_PLUGIN_PUBLISH_PATH)/${OS}-${ARCH}/discovery/standalone" --local-output-distribution-dir "$(TANZU_PLUGIN_PUBLISH_PATH)/${OS}-${ARCH}/distribution" --input-artifact-dir $(ARTIFACTS_DIR) - -.PHONY: install-local -install-local: ## Install the locally built plugins - $(TZBIN) plugin install all --local $(TANZU_PLUGIN_PUBLISH_PATH)/${GOHOSTOS}-${GOHOSTARCH} - -.PHONY: build-install-local -build-install-local: build-local publish-local ## Build and Install plugin for local OS-ARCH - $(TZBIN) plugin install all --local $(TANZU_PLUGIN_PUBLISH_PATH)/${GOHOSTOS}-${GOHOSTARCH} - -.PHONY: release -release: $(BUILD_JOBS) $(PUBLISH_JOBS) # Generates release directory structure for all plugins under `./artifacts/published` (default) - .PHONY: lint lint: $(GOLANGCI_LINT) ## Lint the plugin $(GOLANGCI_LINT) run -v -.PHONY: init -init:go.mod go.sum ## Initialise the plugin +.PHONY: gomod +gomod: ## Update go module dependencies + go mod tidy .PHONY: test -test: $(GO_SRCS) go.sum +test: go test ./... $(TOOLS_BIN_DIR): diff --git a/cmd/plugin/builder/template/plugintemplates/main.go.tmpl b/cmd/plugin/builder/template/plugintemplates/main.go.tmpl index 4013a5b1c..1cf38dd1d 100644 --- a/cmd/plugin/builder/template/plugintemplates/main.go.tmpl +++ b/cmd/plugin/builder/template/plugintemplates/main.go.tmpl @@ -3,6 +3,7 @@ package main import ( "os" + "github.com/vmware-tanzu/tanzu-plugin-runtime/config/types" "github.com/vmware-tanzu/tanzu-plugin-runtime/log" "github.com/vmware-tanzu/tanzu-plugin-runtime/plugin" "github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo" @@ -11,6 +12,7 @@ import ( var descriptor = plugin.PluginDescriptor{ Name: "{{ .PluginName | ToLower }}", Description: "{{ .Description | ToLower }}", + Target: types.TargetUnknown, Version: buildinfo.Version, BuildSHA: buildinfo.SHA, Group: plugin.ManageCmdGroup, // set group diff --git a/cmd/plugin/builder/template/plugintemplates/plugin-tooling.mk.tmpl b/cmd/plugin/builder/template/plugintemplates/plugin-tooling.mk.tmpl new file mode 100644 index 000000000..42017a025 --- /dev/null +++ b/cmd/plugin/builder/template/plugintemplates/plugin-tooling.mk.tmpl @@ -0,0 +1,190 @@ +# Copyright 2023 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Ensure Make is run with bash shell as some syntax below is bash-specific +SHELL := /usr/bin/env bash + +GOHOSTOS ?= $(shell go env GOHOSTOS) +GOHOSTARCH ?= $(shell go env GOHOSTARCH) + +NUL = /dev/null +ifeq ($(GOHOSTOS),windows) + NUL = NUL +endif + +# Build and version information + +PLUGIN_BUILD_SHA ?= $(shell git describe --match=$(git rev-parse --short HEAD) --always --dirty) +PLUGIN_BUILD_DATE ?= $(shell date -u +"%Y-%m-%d") +PLUGIN_BUILD_VERSION ?= $(shell git describe --tags 2>$(NUL)) + +ifeq ($(strip $(PLUGIN_BUILD_VERSION)),) +PLUGIN_BUILD_VERSION = v0.0.0 +endif +PLUGIN_LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=$(PLUGIN_BUILD_DATE)' +PLUGIN_LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=$(PLUGIN_BUILD_SHA)' +PLUGIN_LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=$(PLUGIN_BUILD_VERSION)' + +# Add supported OS-ARCHITECTURE combinations here +PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 + +# Paths and Directory information +ROOT_DIR := $(shell git rev-parse --show-toplevel) + +PLUGIN_DIR := ./cmd/plugin +PLUGIN_BINARY_ARTIFACTS_DIR := $(ROOT_DIR)/artifacts/plugins +PLUGIN_PACKAGE_ARTIFACTS_DIR := $(ROOT_DIR)/artifacts/packages +PLUGIN_MANIFEST_FILE := $(PLUGIN_PACKAGE_ARTIFACTS_DIR)/plugin_manifest.yaml +PLUGIN_GROUP_MANIFEST_FILE := $(PLUGIN_BINARY_ARTIFACTS_DIR)/plugin_group_manifest.yaml + +REGISTRY_PORT ?= 5001 +REGISTRY_ENDPOINT ?= localhost:$(REGISTRY_PORT) +PLUGIN_NAME ?= * + +# Repository specific configuration +TZBIN ?= tanzu +BUILDER_PLUGIN ?= $(TZBIN) builder +PUBLISHER ?= tzcli +VENDOR ?= vmware +PLUGIN_PUBLISH_REPOSITORY ?= localhost:$(REGISTRY_PORT)/test/v1/tanzu-cli/plugins +PLUGIN_INVENTORY_IMAGE_TAG ?= latest + +PLUGIN_SCOPE_ASSOCIATION_FILE ?= "" +PLUGIN_GROUP_NAME ?= + +# Process configuration and setup additional variables +TANZU_BUILDER_OVERRIDE ?= +OVERRIDE_FLAG = +ifneq ($(strip $(TANZU_BUILDER_OVERRIDE)),) +OVERRIDE_FLAG = --override +endif + +## -------------------------------------- +## Plugin Build and Publish Tooling +## -------------------------------------- + +PLUGIN_BUILD_TARGETS := $(addprefix plugin-build-,${PLUGIN_BUILD_OS_ARCH}) + +.PHONY: plugin-build-install-local ## Build and Install all plugins using local plugin artifacts directory +plugin-build-install-local: plugin-build-local plugin-install-local + +.PHONY: plugin-install-local ## Install all plugins from local plugin artifacts directory +plugin-install-local: + tanzu plugin install all --local $(PLUGIN_BINARY_ARTIFACTS_DIR)/$(GOHOSTOS)/$(GOHOSTARCH) + +.PHONY: plugin-build +plugin-build: $(PLUGIN_BUILD_TARGETS) generate-plugin-bundle ## Build all plugin binaries for all supported os-arch + +plugin-build-local: plugin-build-$(GOHOSTOS)-$(GOHOSTARCH) ## Build all plugin binaries for local platform + +plugin-build-%: + $(eval ARCH = $(word 2,$(subst -, ,$*))) + $(eval OS = $(word 1,$(subst -, ,$*))) + $(BUILDER_PLUGIN) plugin build \ + --path $(PLUGIN_DIR) \ + --binary-artifacts $(PLUGIN_BINARY_ARTIFACTS_DIR) \ + --version $(PLUGIN_BUILD_VERSION) \ + --ldflags "$(PLUGIN_LD_FLAGS)" \ + --os-arch $(OS)_$(ARCH) \ + --match "$(PLUGIN_NAME)" \ + --plugin-scope-association-file $(PLUGIN_SCOPE_ASSOCIATION_FILE) + +.PHONY: plugin-build-packages +plugin-build-packages: plugin-local-registry ## Build plugin packages + $(BUILDER_PLUGIN) plugin build-package \ + --binary-artifacts $(PLUGIN_BINARY_ARTIFACTS_DIR) \ + --package-artifacts $(PLUGIN_PACKAGE_ARTIFACTS_DIR) \ + --oci-registry $(REGISTRY_ENDPOINT) + +.PHONY: plugin-publish-packages +plugin-publish-packages: plugin-build-packages ## Publish plugin packages + $(BUILDER_PLUGIN) plugin publish-package \ + --package-artifacts $(PLUGIN_PACKAGE_ARTIFACTS_DIR) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) + +.PHONY: plugin-build-and-publish-packages +plugin-build-and-publish-packages: plugin-build plugin-publish-packages ## Build and Publish plugin packages + +.PHONY: inventory-init +inventory-init: ## Initialize empty plugin inventory + $(BUILDER_PLUGIN) inventory init \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + $(OVERRIDE_FLAG) + +.PHONY: inventory-plugin-add +inventory-plugin-add: ## Add plugins to the inventory database + $(BUILDER_PLUGIN) inventory plugin add \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --manifest $(PLUGIN_MANIFEST_FILE) + +.PHONY: inventory-plugin-activate +inventory-plugin-activate: ## Activate plugins in the inventory database + $(BUILDER_PLUGIN) inventory plugin activate \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --manifest $(PLUGIN_MANIFEST_FILE) + +.PHONY: inventory-plugin-deactivate +inventory-plugin-deactivate: ## Deactivate plugins in the inventory database + $(BUILDER_PLUGIN) inventory plugin deactivate \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --manifest $(PLUGIN_MANIFEST_FILE) + +.PHONY: inventory-plugin-group-add +inventory-plugin-group-add: ## Add plugin-group to the inventory database. Requires PLUGIN_GROUP_NAME + $(BUILDER_PLUGIN) inventory plugin-group add \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --manifest $(PLUGIN_GROUP_MANIFEST_FILE) \ + --name $(PLUGIN_GROUP_NAME) \ + $(OVERRIDE_FLAG) + +.PHONY: inventory-plugin-group-activate +inventory-plugin-group-activate: ## Activate plugin-group in the inventory database. Requires PLUGIN_GROUP_NAME + $(BUILDER_PLUGIN) inventory plugin-group activate \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --name $(PLUGIN_GROUP_NAME) + +.PHONY: inventory-plugin-group-deactivate +inventory-plugin-group-deactivate: ## Deactivate plugin-group in the inventory database. Requires PLUGIN_GROUP_NAME + $(BUILDER_PLUGIN) inventory plugin-group deactivate \ + --repository $(PLUGIN_PUBLISH_REPOSITORY) \ + --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ + --publisher $(PUBLISHER) \ + --vendor $(VENDOR) \ + --name $(PLUGIN_GROUP_NAME) + +## -------------------------------------- +## docker +## -------------------------------------- + +.PHONY: plugin-local-registry +plugin-local-registry: plugin-clean-registry ## Starts up a local docker registry for generating packages + docker run -d -p $(REGISTRY_PORT):5000 --name temp-package-registry mirror.gcr.io/library/registry:2 + +.PHONY: plugin-clean-registry +plugin-clean-registry: ## Stops and removes local docker registry + docker stop temp-package-registry && docker rm -v temp-package-registry || true + +## -------------------------------------- +## Helpers +## -------------------------------------- + +generate-plugin-bundle: + cd $(PLUGIN_BINARY_ARTIFACTS_DIR) && tar -czvf ../plugin_bundle.tar.gz . diff --git a/cmd/plugin/builder/template/plugintemplates/templates.go b/cmd/plugin/builder/template/plugintemplates/templates.go index 2997188ea..3e135343d 100644 --- a/cmd/plugin/builder/template/plugintemplates/templates.go +++ b/cmd/plugin/builder/template/plugintemplates/templates.go @@ -35,6 +35,11 @@ var Makefile string //go:embed common.mk.tmpl var CommonMK string +// PluginToolingMK contains the plugin tooling +// +//go:embed plugin-tooling.mk.tmpl +var PluginToolingMK string + // MainGo contains the plugin main.go template // //go:embed main.go.tmpl diff --git a/cmd/plugin/builder/template/root.go b/cmd/plugin/builder/template/root.go index c7b3dc9ab..d6ee945f8 100644 --- a/cmd/plugin/builder/template/root.go +++ b/cmd/plugin/builder/template/root.go @@ -52,6 +52,12 @@ var Makefile = Target{ Template: plugintemplates.Makefile, } +// PluginToolingMK target +var PluginToolingMK = Target{ + Filepath: "plugin-tooling.mk", + Template: plugintemplates.PluginToolingMK, +} + // Codeowners target // TODO (pbarker): replace with the CLI reviewers group var Codeowners = Target{ diff --git a/cmd/plugin/builder/template/target.go b/cmd/plugin/builder/template/target.go index 0ac4faa63..da51154c2 100644 --- a/cmd/plugin/builder/template/target.go +++ b/cmd/plugin/builder/template/target.go @@ -66,6 +66,7 @@ var DefaultInitTargets = []Target{ GolangCIConfig, Tools, CommonMK, + PluginToolingMK, } // DefaultPluginTargets are the default plugin targets. diff --git a/plugin-tooling.mk b/plugin-tooling.mk index fd9ca8411..5bc5f64fc 100644 --- a/plugin-tooling.mk +++ b/plugin-tooling.mk @@ -4,8 +4,6 @@ # Ensure Make is run with bash shell as some syntax below is bash-specific SHELL := /usr/bin/env bash -# Build and version information - GOHOSTOS ?= $(shell go env GOHOSTOS) GOHOSTARCH ?= $(shell go env GOHOSTARCH) @@ -13,12 +11,15 @@ NUL = /dev/null ifeq ($(GOHOSTOS),windows) NUL = NUL endif + +# Build and version information + PLUGIN_BUILD_SHA ?= $(shell git describe --match=$(git rev-parse --short HEAD) --always --dirty) PLUGIN_BUILD_DATE ?= $(shell date -u +"%Y-%m-%d") PLUGIN_BUILD_VERSION ?= $(shell git describe --tags 2>$(NUL)) ifeq ($(strip $(PLUGIN_BUILD_VERSION)),) -PLUGIN_BUILD_VERSION = dev +PLUGIN_BUILD_VERSION = v0.0.0 endif PLUGIN_LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=$(PLUGIN_BUILD_DATE)' PLUGIN_LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=$(PLUGIN_BUILD_SHA)' @@ -41,7 +42,7 @@ REGISTRY_ENDPOINT ?= localhost:$(REGISTRY_PORT) PLUGIN_NAME ?= * # Repository specific configuration -BUILDER ?= $(ROOT_DIR)/bin/builder +BUILDER_PLUGIN ?= $(ROOT_DIR)/bin/builder PUBLISHER ?= tzcli VENDOR ?= vmware PLUGIN_PUBLISH_REPOSITORY ?= localhost:$(REGISTRY_PORT)/test/v1/tanzu-cli/plugins @@ -63,6 +64,13 @@ endif PLUGIN_BUILD_TARGETS := $(addprefix plugin-build-,${PLUGIN_BUILD_OS_ARCH}) +.PHONY: plugin-build-install-local ## Build and Install all plugins using local plugin artifacts directory +plugin-build-install-local: plugin-build-local plugin-install-local + +.PHONY: plugin-install-local ## Install all plugins from local plugin artifacts directory +plugin-install-local: + tanzu plugin install all --local $(PLUGIN_BINARY_ARTIFACTS_DIR)/$(GOHOSTOS)/$(GOHOSTARCH) + .PHONY: plugin-build plugin-build: $(PLUGIN_BUILD_TARGETS) generate-plugin-bundle ## Build all plugin binaries for all supported os-arch @@ -71,7 +79,7 @@ plugin-build-local: plugin-build-$(GOHOSTOS)-$(GOHOSTARCH) ## Build all plugin b plugin-build-%: $(eval ARCH = $(word 2,$(subst -, ,$*))) $(eval OS = $(word 1,$(subst -, ,$*))) - $(BUILDER) plugin build \ + $(BUILDER_PLUGIN) plugin build \ --path $(PLUGIN_DIR) \ --binary-artifacts $(PLUGIN_BINARY_ARTIFACTS_DIR) \ --version $(PLUGIN_BUILD_VERSION) \ @@ -81,33 +89,33 @@ plugin-build-%: --plugin-scope-association-file $(PLUGIN_SCOPE_ASSOCIATION_FILE) .PHONY: plugin-build-packages -plugin-build-packages: local-registry ## Build plugin packages - $(BUILDER) plugin build-package \ +plugin-build-packages: plugin-local-registry ## Build plugin packages + $(BUILDER_PLUGIN) plugin build-package \ --binary-artifacts $(PLUGIN_BINARY_ARTIFACTS_DIR) \ --package-artifacts $(PLUGIN_PACKAGE_ARTIFACTS_DIR) \ --oci-registry $(REGISTRY_ENDPOINT) .PHONY: plugin-publish-packages -plugin-publish-packages: ## Publish plugin packages - $(BUILDER) plugin publish-package \ +plugin-publish-packages: plugin-build-packages ## Publish plugin packages + $(BUILDER_PLUGIN) plugin publish-package \ --package-artifacts $(PLUGIN_PACKAGE_ARTIFACTS_DIR) \ --publisher $(PUBLISHER) \ --vendor $(VENDOR) \ --repository $(PLUGIN_PUBLISH_REPOSITORY) .PHONY: plugin-build-and-publish-packages -plugin-build-and-publish-packages: plugin-build plugin-build-packages plugin-publish-packages ## Build and Publish plugin packages +plugin-build-and-publish-packages: plugin-build plugin-publish-packages ## Build and Publish plugin packages .PHONY: inventory-init inventory-init: ## Initialize empty plugin inventory - $(BUILDER) inventory init \ + $(BUILDER_PLUGIN) inventory init \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ $(OVERRIDE_FLAG) .PHONY: inventory-plugin-add inventory-plugin-add: ## Add plugins to the inventory database - $(BUILDER) inventory plugin add \ + $(BUILDER_PLUGIN) inventory plugin add \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -116,7 +124,7 @@ inventory-plugin-add: ## Add plugins to the inventory database .PHONY: inventory-plugin-activate inventory-plugin-activate: ## Activate plugins in the inventory database - $(BUILDER) inventory plugin activate \ + $(BUILDER_PLUGIN) inventory plugin activate \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -125,7 +133,7 @@ inventory-plugin-activate: ## Activate plugins in the inventory database .PHONY: inventory-plugin-deactivate inventory-plugin-deactivate: ## Deactivate plugins in the inventory database - $(BUILDER) inventory plugin deactivate \ + $(BUILDER_PLUGIN) inventory plugin deactivate \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -134,7 +142,7 @@ inventory-plugin-deactivate: ## Deactivate plugins in the inventory database .PHONY: inventory-plugin-group-add inventory-plugin-group-add: ## Add plugin-group to the inventory database. Requires PLUGIN_GROUP_NAME - $(BUILDER) inventory plugin-group add \ + $(BUILDER_PLUGIN) inventory plugin-group add \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -145,7 +153,7 @@ inventory-plugin-group-add: ## Add plugin-group to the inventory database. Requi .PHONY: inventory-plugin-group-activate inventory-plugin-group-activate: ## Activate plugin-group in the inventory database. Requires PLUGIN_GROUP_NAME - $(BUILDER) inventory plugin-group activate \ + $(BUILDER_PLUGIN) inventory plugin-group activate \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -154,7 +162,7 @@ inventory-plugin-group-activate: ## Activate plugin-group in the inventory datab .PHONY: inventory-plugin-group-deactivate inventory-plugin-group-deactivate: ## Deactivate plugin-group in the inventory database. Requires PLUGIN_GROUP_NAME - $(BUILDER) inventory plugin-group deactivate \ + $(BUILDER_PLUGIN) inventory plugin-group deactivate \ --repository $(PLUGIN_PUBLISH_REPOSITORY) \ --plugin-inventory-image-tag $(PLUGIN_INVENTORY_IMAGE_TAG) \ --publisher $(PUBLISHER) \ @@ -165,12 +173,12 @@ inventory-plugin-group-deactivate: ## Deactivate plugin-group in the inventory d ## docker ## -------------------------------------- -.PHONY: local-registry -local-registry: clean-registry ## Starts up a local docker registry for generating packages +.PHONY: plugin-local-registry +plugin-local-registry: plugin-clean-registry ## Starts up a local docker registry for generating packages docker run -d -p $(REGISTRY_PORT):5000 --name temp-package-registry mirror.gcr.io/library/registry:2 -.PHONY: clean-registry -clean-registry: ## Stops and removes local docker registry +.PHONY: plugin-clean-registry +plugin-clean-registry: ## Stops and removes local docker registry docker stop temp-package-registry && docker rm -v temp-package-registry || true ## --------------------------------------