github.com/joelanford/operator-sdk@v0.8.2/Makefile (about) 1 # kernel-style V=1 build verbosity 2 ifeq ("$(origin V)", "command line") 3 BUILD_VERBOSE = $(V) 4 endif 5 6 ifeq ($(BUILD_VERBOSE),1) 7 Q = 8 else 9 Q = @ 10 endif 11 12 VERSION = $(shell git describe --dirty --tags --always) 13 GIT_COMMIT = $(shell git rev-parse HEAD) 14 REPO = github.com/operator-framework/operator-sdk 15 BUILD_PATH = $(REPO)/cmd/operator-sdk 16 PKGS = $(shell go list ./... | grep -v /vendor/) 17 SOURCES = $(shell find . -name '*.go' -not -path "*/vendor/*") 18 19 ANSIBLE_BASE_IMAGE = quay.io/operator-framework/ansible-operator 20 HELM_BASE_IMAGE = quay.io/operator-framework/helm-operator 21 SCORECARD_PROXY_BASE_IMAGE = quay.io/operator-framework/scorecard-proxy 22 23 ANSIBLE_IMAGE ?= $(ANSIBLE_BASE_IMAGE) 24 HELM_IMAGE ?= $(HELM_BASE_IMAGE) 25 SCORECARD_PROXY_IMAGE ?= $(SCORECARD_PROXY_BASE_IMAGE) 26 27 export CGO_ENABLED:=0 28 29 all: format test build/operator-sdk 30 31 format: 32 $(Q)go fmt $(PKGS) 33 34 dep: 35 $(Q)dep ensure -v 36 37 dep-update: 38 $(Q)dep ensure -update -v 39 40 clean: 41 $(Q)rm -rf build 42 43 .PHONY: all test format dep clean 44 45 install: 46 $(Q)go install \ 47 -gcflags "all=-trimpath=${GOPATH}" \ 48 -asmflags "all=-trimpath=${GOPATH}" \ 49 -ldflags " \ 50 -X '${REPO}/version.GitVersion=${VERSION}' \ 51 -X '${REPO}/version.GitCommit=${GIT_COMMIT}' \ 52 " \ 53 $(BUILD_PATH) 54 55 release_x86_64 := \ 56 build/operator-sdk-$(VERSION)-x86_64-linux-gnu \ 57 build/operator-sdk-$(VERSION)-x86_64-apple-darwin 58 59 release: clean $(release_x86_64) $(release_x86_64:=.asc) 60 61 build/operator-sdk-%-x86_64-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64 62 build/operator-sdk-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64 63 64 build/%: $(SOURCES) 65 $(Q)$(GOARGS) go build \ 66 -gcflags "all=-trimpath=${GOPATH}" \ 67 -asmflags "all=-trimpath=${GOPATH}" \ 68 -ldflags " \ 69 -X '${REPO}/version.GitVersion=${VERSION}' \ 70 -X '${REPO}/version.GitCommit=${GIT_COMMIT}' \ 71 " \ 72 -o $@ $(BUILD_PATH) 73 74 build/%.asc: 75 $(Q){ \ 76 default_key=$$(gpgconf --list-options gpg | awk -F: '$$1 == "default-key" { gsub(/"/,""); print toupper($$10)}'); \ 77 git_key=$$(git config --get user.signingkey | awk '{ print toupper($$0) }'); \ 78 if [ "$${default_key}" = "$${git_key}" ]; then \ 79 gpg --output $@ --detach-sig build/$*; \ 80 gpg --verify $@ build/$*; \ 81 else \ 82 echo "git and/or gpg are not configured to have default signing key $${default_key}"; \ 83 exit 1; \ 84 fi; \ 85 } 86 87 .PHONY: install release_x86_64 release 88 89 test: test/unit 90 91 test-ci: test/markdown test/sanity test/unit install test/subcommand test/e2e 92 93 test/ci-go: test/subcommand test/e2e/go 94 95 test/ci-ansible: test/e2e/ansible test/e2e/ansible-molecule 96 97 test/ci-helm: test/e2e/helm 98 99 test/sanity: 100 ./hack/tests/sanity-check.sh 101 102 test/unit: 103 $(Q)go test -count=1 -short ./cmd/... 104 $(Q)go test -count=1 -short ./pkg/... 105 $(Q)go test -count=1 -short ./internal/... 106 107 test/subcommand: test/subcommand/test-local test/subcommand/scorecard 108 109 test/subcommand/test-local: 110 ./hack/tests/test-subcommand.sh 111 112 test/subcommand/scorecard: 113 ./hack/tests/scorecard-subcommand.sh 114 115 test/e2e: test/e2e/go test/e2e/ansible test/e2e/ansible-molecule test/e2e/helm 116 117 test/e2e/go: 118 ./hack/tests/e2e-go.sh $(ARGS) 119 120 test/e2e/ansible: image/build/ansible 121 ./hack/tests/e2e-ansible.sh 122 123 test/e2e/ansible-molecule: 124 ./hack/tests/e2e-ansible-molecule.sh 125 126 test/e2e/helm: image/build/helm 127 ./hack/tests/e2e-helm.sh 128 129 test/markdown: 130 ./hack/ci/marker --root=doc 131 132 .PHONY: test test-ci test/sanity test/unit test/subcommand test/e2e test/e2e/go test/e2e/ansible test/e2e/ansible-molecule test/e2e/helm test/ci-go test/ci-ansible test/ci-helm test/markdown 133 134 image: image/build image/push 135 136 image/build: image/build/ansible image/build/helm image/build/scorecard-proxy 137 138 image/build/ansible: build/operator-sdk-dev-x86_64-linux-gnu 139 ./hack/image/build-ansible-image.sh $(ANSIBLE_BASE_IMAGE):dev 140 141 image/build/helm: build/operator-sdk-dev-x86_64-linux-gnu 142 ./hack/image/build-helm-image.sh $(HELM_BASE_IMAGE):dev 143 144 image/build/scorecard-proxy: 145 ./hack/image/build-scorecard-proxy-image.sh $(SCORECARD_PROXY_BASE_IMAGE):dev 146 147 image/push: image/push/ansible image/push/helm image/push/scorecard-proxy 148 149 image/push/ansible: 150 ./hack/image/push-image-tags.sh $(ANSIBLE_BASE_IMAGE):dev $(ANSIBLE_IMAGE) 151 152 image/push/helm: 153 ./hack/image/push-image-tags.sh $(HELM_BASE_IMAGE):dev $(HELM_IMAGE) 154 155 image/push/scorecard-proxy: 156 ./hack/image/push-image-tags.sh $(SCORECARD_PROXY_BASE_IMAGE):dev $(SCORECARD_PROXY_IMAGE) 157 158 .PHONY: image image/build image/build/ansible image/build/helm image/push image/push/ansible image/push/helm