-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (45 loc) · 1.42 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
# Default Settings
LEAKTK_GCS_FILTER_CONCURRENCY ?= 10
LEAKTK_GCS_FILTER_CPU ?= 2
LEAKTK_GCS_FILTER_MEMORY ?= 256Mi
LEAKTK_GCS_FILTER_TIMEOUT ?= 5s
LEAKTK_PATTERN_SERVER_URL ?= https://raw.githubusercontent.com/leaktk/patterns/main/target
# Build the deploy flags
DEPLOY_FLAGS := --gen2 --runtime=go122 --region=$(LEAKTK_GCS_FILTER_REGION)
DEPLOY_FLAGS += --source=dist --entry-point=AnalyzeObject
DEPLOY_FLAGS += --trigger-bucket=$(LEAKTK_GCS_FILTER_TRIGGER_BUCKET) --project=$(LEAKTK_GCS_FILTER_PROJECT)
DEPLOY_FLAGS += --cpu=$(LEAKTK_GCS_FILTER_CPU) --memory=$(LEAKTK_GCS_FILTER_MEMORY)
DEPLOY_FLAGS += --concurrency=$(LEAKTK_GCS_FILTER_CONCURRENCY) --timeout=$(LEAKTK_GCS_FILTER_TIMEOUT)
DEPLOY_FLAGS += --env-vars-file=.env.yaml
.PHONY: clean
clean:
git clean -dfX
.env.yaml:
./scripts/gen-env-vars-file > .env.yaml
dist:
rm -rf dist
cp -r src dist
curl --fail $(LEAKTK_PATTERN_SERVER_CURL_FLAGS) \
'$(LEAKTK_PATTERN_SERVER_URL)/patterns/gitleaks/7.6.1' \
| grep -vE '^\s*(#|$$)' > 'dist/config/gitleaks.toml'
.PHONY: format
format:
cd src && go fmt ./...
.PHONY: lint
lint:
cd src && golint ./...
.PHONY: deploy
deploy: .env.yaml dist
cd dist
gcloud functions deploy leaktk-gcs-filter $(DEPLOY_FLAGS)
.PHONY: unittest
unittest: clean dist
cd dist && go test
.PHONY: test
test: lint unittest
.PHONY: security-report
security-report:
trivy fs --scanners vuln .
.PHONY: update
update:
cd src && go get -u ./... && go mod tidy