forked from kedacore/keda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (66 loc) · 2.47 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
65
66
67
68
69
70
71
72
73
74
75
76
77
##################################################
# Variables #
##################################################
ARCH?=amd64
CGO?=0
TARGET_OS?=linux
##################################################
# Variables #
##################################################
GIT_VERSION = $(shell git describe --always --abbrev=7)
GIT_COMMIT = $(shell git rev-list -1 HEAD)
DATE = $(shell date -u +"%Y.%m.%d.%H.%M.%S")
##################################################
# Tests #
##################################################
.PHONY: test
test:
# Add actual test script
go test ./...
.PHONY: e2e-test
e2e-test:
./tests/run_tests.sh
##################################################
# Build #
##################################################
.PHONY: build
build:
CGO_ENABLED=$(CGO) GOOS=$(TARGET_OS) GOARCH=$(ARCH) go build \
-ldflags "-X main.GitCommit=$(GIT_COMMIT)" \
-o dist/keda \
cmd/main.go
##################################################
# Helm Chart tasks #
##################################################
.PHONY: build-chart-edge
build-chart-edge:
rm -rf /tmp/keda-edge
cp -r -L chart/keda /tmp/keda-edge
sed -i "s/^name:.*/name: keda-edge/g" /tmp/keda-edge/Chart.yaml
sed -i "s/^version:.*/version: 0.0.1-$(DATE)-$(GIT_VERSION)/g" /tmp/keda-edge/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: $(GIT_VERSION)/g" /tmp/keda-edge/Chart.yaml
helm lint /tmp/keda-edge/
helm package /tmp/keda-edge/
.PHONY: publish-edge-chart
publish-edge-chart: build-chart-edge
$(eval CHART := $(shell find . -maxdepth 1 -type f -iname 'keda-edge-0.0.1-*' -print -quit))
@az storage blob upload \
--container-name helm \
--name $(CHART) \
--file $(CHART) \
--account-name kedacore \
--sas-token "$(STORAGE_HELM_SAS_TOKEN)"
@az storage blob download \
--container-name helm \
--name index.yaml \
--file old_index.yaml \
--account-name kedacore \
--sas-token "$(STORAGE_HELM_SAS_TOKEN)" 2>/dev/null | true
[ -s ./old_index.yaml ] && helm repo index . --url https://kedacore.azureedge.net/helm --merge old_index.yaml || true
[ ! -s ./old_index.yaml ] && helm repo index . --url https://kedacore.azureedge.net/helm || true
@az storage blob upload \
--container-name helm \
--name index.yaml \
--file index.yaml \
--account-name kedacore \
--sas-token "$(STORAGE_HELM_SAS_TOKEN)"