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