-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (56 loc) · 2.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
APP_NAME = armory
APP_EXT ?= "${CLI_EXT}"
VERSION ?= $(shell ./scripts/version.sh | cut -c -30)#limit the version to 30 characters -
IMAGE_TAG_VERSION ?= "$(VERSION)"
REGISTRY ?= armory-docker-local.jfrog.io
REGISTRY_ORG ?= armory
GOARCH ?= $(shell go env GOARCH)
GOOS ?= $(shell go env GOOS)
PWD = $(shell pwd)
IMAGE_TAG ?= local
LOCAL_KUBECTL_CONTEXT ?= kind-armory-cloud-dev
IMAGE := ${REGISTRY}/${REGISTRY_ORG}/${APP_NAME}-cli
BUILD_DIR := ${PWD}/build
DIST_DIR := ${BUILD_DIR}/dist/${GOOS}_${GOARCH}
GEN_DIR := ${PWD}/generated
MAIN_PATH := main.go
TIMESTAMP := $(shell date -u +"%FT%TZ")
default: all
include ./scripts/common_targets.mk
.PHONY: all
all: clean build-dirs run-before-tools build check run-after-tools
.PHONY: tools
tools:
echo installing tools.... && \
go install github.com/vakenbolt/[email protected] && \
go install github.com/undoio/delve/cmd/dlv@latest && \
echo installing static check... && \
go install honnef.co/go/tools/cmd/staticcheck@latest
.PHONY: configure-build
configure-build:
@go env -w CGO_ENABLED=0
@go env
.PHONY: integration
integration: build-dirs install-tools
@go test -v -cover ./integration/... -json > ${BUILD_DIR}/reports/integration-test-report.json
@go test -v -coverprofile=${BUILD_DIR}/reports/integration.cov ./integration/...
@cat ${BUILD_DIR}/reports/integration-test-report.json | go-test-report --title ${APP_NAME}-integration-test -v --output ${BUILD_DIR}/reports/integration_test_report.html
.PHONY: release
release: clean build-linux-amd64
ifdef PUSH
$(info PUSH flag set, will publish the image after build)
endif
@docker build \
--tag $(IMAGE):$(IMAGE_TAG) \
--tag $(IMAGE):$(IMAGE_TAG_VERSION) \
--label "org.opencontainers.image.created=$(TIMESTAMP)" \
--label "org.opencontainers.image.description=The CLI for Armory Continuous Deployments-as-a-Service" \
--label "org.opencontainers.image.revision=$(GITHUB_SHA)" \
--label "org.opencontainers.image.licenses=Apache-2.0" \
--label "org.opencontainers.image.source=https://github.com/armory-io/armory-cli" \
--label "org.opencontainers.image.title=armory-cli" \
--label "org.opencontainers.image.url=https://github.com/armory-io/armory-cli" \
--label "org.opencontainers.image.version=$(VERSION)" \
$(if $(PUSH), --push) \
--file Dockerfile \
.