forked from sathishdsgithub/kubequery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (42 loc) · 1.45 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
#!/usr/bin/make -f
# Copyright (c) 2020-present, The kubequery authors
#
# This source code is licensed as defined by the LICENSE file found in the
# root directory of this source tree.
#
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
ifeq ($(VERSION),)
VERSION := $(shell git describe --tags HEAD | cut -d'-' -f1-2 | sed 's/-/./')
endif
all: deps lint test build kubequery.yaml
deps:
@go mod download
lint:
@go install honnef.co/go/tools/cmd/staticcheck@latest
@go install golang.org/x/lint/golint
@staticcheck ./...
@golint ./...
build: deps
@go build -ldflags="-s -w -X main.VERSION=${VERSION}" -o bin ./...
test:
@go test -race -cover ./...
integration:
@node integration/index.js
docker: build
@docker build --build-arg KUBEQUERY_VERSION=${VERSION} -t uptycs/kubequery:${VERSION} .
genschema: build
@./bin/gentables > docs/tables.json
@echo "\`\`\`sql" > docs/schema.md
@./bin/genschema >> docs/schema.md
@echo "\`\`\`" >> docs/schema.md
kubequery.yaml:
@sed -e "s/^/ /g" etc/kubequery.flags > etc/kubequery.flags.tmp
@sed -e "s/^/ /g" etc/kubequery.conf > etc/kubequery.conf.tmp
@sed -e "/kubequery.flags: |/r etc/kubequery.flags.tmp" \
-e "/kubequery.conf: |/r etc/kubequery.conf.tmp" \
-e "s/version: latest/version: ${VERSION}/g" \
kubequery-template.yaml > kubequery.yaml
@rm -f etc/*.tmp
clean:
@rm -rf vendor kubequery.yaml bin/kubequery bin/genschema bin/uuidgen etc/*.tmp
.PHONY: all integration