Skip to content

Commit 7fa8d3d

Browse files
committed
add build-release script
Signed-off-by: kaizhe <[email protected]>
1 parent e90d436 commit 7fa8d3d

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
vendor*
22
.idea*
33
kube-psp-advisor
4+
advise-psp
45
psp.yaml
6+
*.tar.gz
7+
.DS_Store

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ example:
1313
build:
1414
@echo "+ $@"
1515
./scripts/build
16+
build-release:
17+
@echo "+ $@"
18+
./scripts/build-release
1619
build-image:
1720
@echo "+ $@"
1821
docker build -f container/Dockerfile -t ${IMG}:${VERSION} .

kube-psp-advisor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ func main() {
153153
} else {
154154
inspectCmd.Flags().StringVar(&kubeconfig, "kubeconfig", "", "absolute path to the kubeconfig file")
155155
}
156-
inspectCmd.Flags().BoolVar(&withReport, "report", false, "(optional) return with detail report")
157-
inspectCmd.Flags().BoolVar(&withGrant, "grant", false, "(optional) return with pod security policies, roles and rolebindings")
158-
inspectCmd.Flags().StringVar(&namespace, "namespace", "", "(optional) namespace")
156+
inspectCmd.Flags().BoolVarP(&withReport, "report", "r", false, "(optional) return with detail report")
157+
inspectCmd.Flags().BoolVarP(&withGrant, "grant", "g", false, "(optional) return with pod security policies, roles and rolebindings")
158+
inspectCmd.Flags().StringVarP(&namespace, "namespace", "n", "", "(optional) namespace")
159159

160160
convertCmd.Flags().StringVar(&podObjFilename, "podFile", "", "Path to a yaml file containing an object with a pod Spec")
161161
convertCmd.Flags().StringVar(&pspFilename, "pspFile", "", "Write the resulting PSP to this file")

scripts/build-release

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
export GO111MODULE=on
6+
7+
$GOPATH/bin/goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*") || true
8+
9+
# build release for MacOS
10+
env GOOS=darwin GOARCH=amd64 go build -a -o advise-psp
11+
12+
tar -cvzf kubectl-advise-psp_${RELEASE}_darwin_amd64.tar.gz advise-psp LICENSE
13+
14+
rm advise-psp
15+
16+
# build release for Linux
17+
env GOOS=linux GOARCH=amd64 go build -a -o advise-psp
18+
19+
tar -cvzf kubectl-advise-psp_${RELEASE}_linux_amd64.tar.gz advise-psp LICENSE
20+
21+
rm advise-psp

0 commit comments

Comments
 (0)