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