fleet/infrastructure/kubequery/Makefile
Lucas Manuel Rodriguez 3b2e97db89
Move kubequery dependency to monorepo (#16027)
#15561

We didn't find a way to preserve history of the original fork (see
[here](https://github.com/fleetdm/fleet/issues/15561#issuecomment-1883473504),
thus we are moving it with one commit.

The second commit updates a reference.
2024-01-11 08:30:26 -03:00

55 lines
1.4 KiB
Makefile

#!/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