-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
70 lines (58 loc) · 2 KB
/
GNUmakefile
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
GO111MODULE=on
.PHONY: test
docker-build:
@docker build -t indykite/opa:latest .
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w .
goimports: gci
gci:
@echo "==> Fixing imports code with gci..."
gci write -s standard -s default -s "prefix(github.com/indykite/opa-indykite-plugin)" -s blank -s dot .
lint:
@echo "==> Checking source code against linters..."
golangci-lint run --timeout 2m0s ./...
install-tools:
@echo Installing tools
@go install github.com/daixiang0/gci@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1
@go install github.com/onsi/ginkgo/v2/ginkgo@latest
@echo Installation completed
test:
go test -v -cpu 4 -covermode=count -coverpkg github.com/indykite/opa-indykite-plugin/... -coverprofile=coverage.out ./...
upgrade:
@echo "==> Upgrading"
@GO111MODULE=on go get -u all && go mod tidy
@echo "==> Upgrading pre-commit"
@pre-commit autoupdate
tidy:
@GO111MODULE=on go mod tidy
opa-ci:
@docker buildx create --name opabuilder --use
@docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t indykite/opa:latest \
-t indykite/opa:$(VERSION) \
-t $(GCR_URL)/$(GCP_PROJECT_ID)/jarvis/opa:test \
-t $(GCR_URL)/$(GCP_PROJECT_ID)/jarvis/opa:$(SHORT_SHA) \
--build-arg SHORT_SHA=$(SHORT_SHA) \
--build-arg TAG_NAME=$(VERSION) \
--build-arg BUILD_DATE=$(NOW) \
--build-arg TAG_NAME=$(GITHUB_REF) \
.
@docker buildx rm opabuilder
# TODO replace the block above after the migration to new GCP project
opa-ci-new:
@docker buildx create --name opabuilder --use
@docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t indykite/opa:latest \
-t indykite/opa:$(VERSION) \
-t $(ARTIFACT_REGISTRY_URL)/$(GCP_PROJECT_ID_MGMT)/indykite/opa:test \
-t $(ARTIFACT_REGISTRY_URL)/$(GCP_PROJECT_ID_MGMT)/indykite/opa:$(SHORT_SHA) \
--build-arg SHORT_SHA=$(SHORT_SHA) \
--build-arg TAG_NAME=$(VERSION) \
--build-arg BUILD_DATE=$(NOW) \
--build-arg TAG_NAME=$(GITHUB_REF) \
.
@docker buildx rm opabuilder