forked from IBM/portieris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (73 loc) · 4.27 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
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
GOPACKAGES=$(shell go list ./... | grep -v test/ | grep -v pkg/apis/)
VERSION=0.7.0
TAG=$(VERSION)
GOTAGS='containers_image_openpgp'
.PHONY: test
image:
docker build -t portieris:$(TAG) .
push: image
docker tag portieris:$(TAG) $(HUB)/portieris:$(TAG)
docker push $(HUB)/portieris:$(TAG)
test-deps:
@go get golang.org/x/lint/golint
alltests: test-deps fmt lint vet copyright-check test
test:
echo 'mode: atomic' > cover.out
for LINE in ${GOPACKAGES}; do sh -c "go test --tags $(GOTAGS) -covermode=atomic -coverprofile=cover.tmp $${LINE} && tail -n +2 cover.tmp >> cover.out"; done
rm cover.tmp
copyright:
@${GOPATH}/src/github.com/IBM/portieris/scripts/copyright.sh
copyright-check:
@${GOPATH}/src/github.com/IBM/portieris/scripts/copyright-check.sh
fmt:
@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
helm install -n 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 $$(pwd)/portieris-$(VERSION).tgz
helm.clean:
-helm/cleanup.sh portieris
e2e:
-helm package helm/portieris
@go test -v ./test/e2e --helmChart $$(pwd)/portieris-$(VERSION).tgz
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
- kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
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 -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.trust.imagepolicy:
@go test -v ./test/e2e --no-install --trust-image-policy --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.trust.clusterimagepolicy:
@go test -v ./test/e2e --no-install --trust-cluster-image-policy --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.wildcards:
@go test -v ./test/e2e --no-install --wildcards-image-policy --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.armada:
@go test -v ./test/e2e --no-install --armada --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.generic:
go test -v ./test/e2e --no-install --generic --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.quick.simple.imagepolicy:
@go test -v ./test/e2e --no-install --simple-image-policy --helmChart $$(pwd)/portieris-$(VERSION).tgz
-kubectl delete namespace $$(kubectl get namespaces | grep -v ibm | grep -v kube | grep -v default | awk '{ print $$1 }' | grep -v NAME)
e2e.helm:
kubectl apply -f test/helm/tiller-rbac.yaml
helm init --service-account tiller
e2e.clean: helm.clean
.PHONY: code-generator regenerate
code-generator:
git clone https://github.com/kubernetes/code-generator.git --branch irelease-1.15 $(GOPATH)/src/k8s.io/code-generator
regenerate:
$(GOPATH)/src/k8s.io/code-generator/generate-groups.sh all github.com/IBM/portieris/pkg/apis/securityenforcement/client github.com/IBM/portieris/pkg/apis securityenforcement:v1beta1