-
Notifications
You must be signed in to change notification settings - Fork 78
/
Makefile
127 lines (89 loc) · 5.06 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
GOFILES=$(shell find . -type f -name '*.go' -not -path "./code-generator/*" -not -path "./pkg/apis/*")
GOPACKAGES=$(shell go list ./... | grep -v test/ | grep -v pkg/apis/)
VERSION=v0.13.22
TAG=$(VERSION)
GOTAGS='containers_image_openpgp'
.PHONY: test nancy test-deps alltests copyright-check copyright fmt detect-secrets image image.oci-archive image.amd64 image.s390x image.arm64
portieris:
CGO_ENABLED=0 go build \
-ldflags="-X github.com/IBM/portieris/internal/info.Version=$(VERSION)" -a \
-tags containers_image_openpgp -o portieris ./cmd/portieris
deps.jsonl: portieris
go version -m -v portieris | (grep dep || true) | awk '{print "{\"Path\": \""$$2 "\", \"Version\": \"" $$3 "\"}"}' > deps.jsonl
nancy: deps.jsonl
cat deps.jsonl | nancy --skip-update-check --loud sleuth
detect-secrets:
detect-secrets audit .secrets.baseline
image: image.amd64
image.oci-archive:
docker buildx build -o type=oci,dest=./portieris.tar --platform linux/amd64,linux/s390x,linux/arm64 --build-arg PORTIERIS_VERSION=$(VERSION) -t portieris:$(TAG) .
image.amd64:
docker buildx build --load --platform linux/amd64 --build-arg PORTIERIS_VERSION=$(VERSION) -t portieris-amd64-linux:$(TAG) .
image.arm64:
docker buildx build --load --platform linux/arm64 --build-arg PORTIERIS_VERSION=$(VERSION) -t portieris-arm64-linux:$(TAG) .
image.s390x:
docker buildx build --load --platform linux/s390x --build-arg PORTIERIS_VERSION=$(VERSION) -t portieris-s390x-linux:$(TAG) .
test-deps:
go install golang.org/x/lint/golint@latest
alltests: test-deps fmt lint vet copyright-check test
test:
./scripts/makeTest.sh "${GOPACKAGES}" ${GOTAGS}
copyright:
./scripts/copyright.sh
copyright-check:
./scripts/copyright-check.sh
fmt:
@gofmt -l ${GOFILES}
@if [ -n "$$(gofmt -l ${GOFILES})" ]; then echo 'Please run gofmt -l -w on your code.' && exit 1; fi
lint:
@set -e; for LINE in ${GOPACKAGES}; do golint -set_exit_status=true $${LINE} ; done
vet:
@set -e; for LINE in ${GOPACKAGES}; do go vet --tags $(GOTAGS) $${LINE} ; done
helm.package:
-rm $$(pwd)/portieris-$(VERSION).tgz
helm package helm/portieris
helm.install.local: helm.package
-kubectl create ns portieris
-kubectl get secret $(PULLSECRET) -o yaml | sed 's/namespace: default/namespace: portieris/' | kubectl create -f -
helm install -n portieris portieris $$(pwd)/portieris-$(VERSION).tgz --set image.host=$(HUB) --set image.tag=$(TAG) --set image.pullSecret=$(PULLSECRET)
helm.install: helm.package
helm install -n portieris portieris $$(pwd)/portieris-$(VERSION).tgz
helm.clean:
-helm/cleanup.sh portieris
e2e:
-helm package helm/portieris
@go test -v ./test/e2e
e2e.local: helm.install.local e2e.quick
e2e.local.ics: helm.install.local e2e.quick.ics
e2e.quick: e2e.quick.trust.imagepolicy e2e.quick.trust.clusterimagepolicy e2e.quick.wildcards e2e.quick.generic e2e.quick.simple.imagepolicy e2e.quick.simple.clusterimagepolicy
e2e.quick.ics: e2e.quick.trust.imagepolicy e2e.quick.trust.clusterimagepolicy e2e.quick.armada e2e.quick.wildcards e2e.quick.generic e2e.quick.simple.imagepolicy
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.trust.imagepolicy:
go test -v ./test/e2e --no-install --trust-image-policy
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.trust.clusterimagepolicy:
go test -v ./test/e2e --no-install --trust-cluster-image-policy
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.wildcards:
go test -v ./test/e2e --no-install --wildcards-image-policy
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.armada:
go test -v ./test/e2e --no-install --armada
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.generic:
go test -v ./test/e2e --no-install --generic
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.simple.clusterimagepolicy:
go test -v ./test/e2e --no-install --simple-cluster-image-policy
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.quick.simple.imagepolicy:
-kubectl delete namespace secretnamespace
go test -v ./test/e2e --no-install --simple-image-policy
-kubectl delete namespace secretnamespace
-kubectl delete namespace $$(kubectl get namespaces | grep '[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*' | awk '{ print $$1 }' )
e2e.clean: helm.clean
.PHONY: code-generator regenerate
code-generator:
go install k8s.io/[email protected]
regenerate:
bash $(GOPATH)/pkg/mod/k8s.io/[email protected]/generate-groups.sh all github.com/IBM/portieris/pkg/apis/portieris.cloud.ibm.com/client github.com/IBM/portieris/pkg/apis portieris.cloud.ibm.com:v1