github.com/mkimuram/operator-sdk@v0.7.1-0.20190410172100-52ad33a4bda0/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)/cmd/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 ./cmd/... 89 $(Q)go test -count=1 -short ./pkg/... 90 $(Q)go test -count=1 -short ./internal/... 91 92 test/subcommand: test/subcommand/test-local test/subcommand/scorecard 93 94 test/subcommand/test-local: 95 ./hack/tests/test-subcommand.sh 96 97 test/subcommand/scorecard: 98 ./hack/tests/scorecard-subcommand.sh 99 100 test/e2e: test/e2e/go test/e2e/ansible test/e2e/ansible-molecule test/e2e/helm 101 102 test/e2e/go: 103 ./hack/tests/e2e-go.sh $(ARGS) 104 105 test/e2e/ansible: image/build/ansible 106 ./hack/tests/e2e-ansible.sh 107 108 test/e2e/ansible-molecule: 109 ./hack/tests/e2e-ansible-molecule.sh 110 111 test/e2e/helm: image/build/helm 112 ./hack/tests/e2e-helm.sh 113 114 test/markdown: 115 ./hack/ci/marker --root=doc 116 117 .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 118 119 image: image/build image/push 120 121 image/build: image/build/ansible image/build/helm image/build/scorecard-proxy 122 123 image/build/ansible: build/operator-sdk-dev-x86_64-linux-gnu 124 ./hack/image/build-ansible-image.sh $(ANSIBLE_BASE_IMAGE):dev 125 126 image/build/helm: build/operator-sdk-dev-x86_64-linux-gnu 127 ./hack/image/build-helm-image.sh $(HELM_BASE_IMAGE):dev 128 129 image/build/scorecard-proxy: 130 ./hack/image/build-scorecard-proxy-image.sh $(SCORECARD_PROXY_BASE_IMAGE):dev 131 132 image/push: image/push/ansible image/push/helm image/push/scorecard-proxy 133 134 image/push/ansible: 135 ./hack/image/push-image-tags.sh $(ANSIBLE_BASE_IMAGE):dev $(ANSIBLE_IMAGE) 136 137 image/push/helm: 138 ./hack/image/push-image-tags.sh $(HELM_BASE_IMAGE):dev $(HELM_IMAGE) 139 140 image/push/scorecard-proxy: 141 ./hack/image/push-image-tags.sh $(SCORECARD_PROXY_BASE_IMAGE):dev $(SCORECARD_PROXY_IMAGE) 142 143 .PHONY: image image/build image/build/ansible image/build/helm image/push image/push/ansible image/push/helm