Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# kernel-style V=1 build verbosity
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
endif

ifeq ($(BUILD_VERBOSE),1)
Q =
else
Q = @
endif

REPO = github.com/operator-framework/api
BUILD_PATH = $(REPO)/cmd/operator-verify
PKGS = $(shell go list ./... | grep -v /vendor/)

.PHONY: help
help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@echo 'Available targets are:'
@echo ''
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: install

install: ## Build & install the operator-verify

$(Q)go install \
-gcflags "all=-trimpath=${GOPATH}" \
-asmflags "all=-trimpath=${GOPATH}" \
-ldflags " \
-X '${REPO}/version.GitVersion=${VERSION}' \
-X '${REPO}/version.GitCommit=${GIT_COMMIT}' \
" \
$(BUILD_PATH)

# Code management.
.PHONY: format tidy clean

format: ## Format the source code
$(Q)go fmt $(PKGS)

tidy: ## Update dependencies
$(Q)go mod tidy -v

clean: ## Clean up the build artifacts
$(Q)rm -rf build

##############################
# Tests #
##############################

##@ Tests

# Static tests.
.PHONY: test test-unit

test: test-unit ## Run the tests

TEST_PKGS:=$(shell go list ./...)
test-unit: ## Run the unit tests
$(Q)go test -short ${TEST_PKGS}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ Contains the API definitions used by [Operator Lifecycle Manager][olm] (OLM) and

[olm]:https://github.com/operator-framework/operator-lifecycle-manager
[marketplace]:https://github.com/operator-framework/operator-marketplace

## Usage

You can install the `operator-verify` tool from source using:

`$ make install`

To verify your ClusterServiceVersion yaml,

`$ operator-verify verify /path/to/filename.yaml`