forked from kubernetes-sigs/kustomize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeKubectlPr.sh
More file actions
109 lines (82 loc) · 2.66 KB
/
makeKubectlPr.sh
File metadata and controls
109 lines (82 loc) · 2.66 KB
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
# Copyright 2022 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
# Build the kubectl integration PR
# Merge pull request #93861 from sttts/sttts-so-reuseaddr-kube
# apiserver: add --permit-address-sharing flag to listen with SO_REUSEADDR
baseCommit=7f083d339f9d4e104cc31e671626c74fd3c83611
repoDir=$HOME/gopath/src/k8s.io/kubernetes
k8sio=staging/src/k8s.io
function saveIt {
mkdir -p ~/safe/$1
cp $1/$2 ~/safe/$1
}
function getIt {
cp ~/safe/$1/$2 $1/$2
}
function doSave {
rm -rf ~/safe
mkdir ~/safe
saveIt ${k8sio}/cli-runtime/pkg/resource builder.go
saveIt ${k8sio}/cli-runtime/pkg/resource kustomizevisitor.go
saveIt ${k8sio}/cli-runtime/pkg/resource kustomizevisitor_test.go
saveIt ${k8sio}/cli-runtime/pkg/resource visitor.go
saveIt ${k8sio}/kubectl/pkg/cmd/kustomize kustomize.go
echo "--- Saved: ----"
tree ~/safe
}
function doReset {
cd $repoDir
git reset $baseCommit --hard
git clean -fd
git log -n 1
git status
}
function doCommit1 {
git mv \
${k8sio}/cli-runtime/pkg/kustomize/builder_test.go \
${k8sio}/cli-runtime/pkg/resource/kustomizevisitor_test.go
git rm -r ${k8sio}/cli-runtime/pkg/kustomize
git rm ${k8sio}/kubectl/pkg/cmd/kustomize/kustomize_test.go
git add --all
git commit -m "Delete ${k8sio}/cli-runtime/pkg/kustomize"
}
function pullCodeFromStash {
getIt ${k8sio}/cli-runtime/pkg/resource builder.go
getIt ${k8sio}/cli-runtime/pkg/resource kustomizevisitor.go
getIt ${k8sio}/cli-runtime/pkg/resource kustomizevisitor_test.go
getIt ${k8sio}/cli-runtime/pkg/resource visitor.go
getIt ${k8sio}/kubectl/pkg/cmd/kustomize kustomize.go
}
function doCommit2 {
(cd ${k8sio}/kubectl; go mod tidy)
(cd ${k8sio}/kubectl; go test ./...)
(cd ${k8sio}/cli-runtime; go mod tidy)
(cd ${k8sio}/cli-runtime; go test ./...)
(cd ${k8sio}/kubectl; go mod tidy)
(cd ${k8sio}/cli-runtime; go mod tidy)
(cd ${k8sio}/kubectl; go mod tidy)
go mod edit --dropreplace=sigs.k8s.io/kustomize
# go mod edit --exclude=sigs.k8s.io/kustomize@v2.0.3+incompatible
git add --all
git commit -m "Manually update kustomize attachment points."
}
function doCommit3 {
./hack/update-vendor.sh
git add --all
git commit -m "Run ./hack/update-vendor.sh"
}
function sanityCheck {
kCtl=./_output/local/go/bin/kubectl
$kCtl help kustomize
$kCtl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
}
function makePrBranch {
doReset
doCommit1
pullCodeFromStash
doCommit2
doCommit3
# make everything
make
sanityCheck
}