mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-29 01:30:51 +00:00
Compare commits
48 Commits
kyaml/v0.9
...
cmd/config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
176ac5b4fa | ||
|
|
dd696b5cb4 | ||
|
|
501404e403 | ||
|
|
ddf94175ee | ||
|
|
232da9e12b | ||
|
|
8b9ce8eacb | ||
|
|
ee9a4f2526 | ||
|
|
006ce72b2d | ||
|
|
a80bd15bda | ||
|
|
6c63bb2727 | ||
|
|
a7ba93b1d8 | ||
|
|
4a78cd6579 | ||
|
|
b2b8c12203 | ||
|
|
8cc281fad6 | ||
|
|
7346813b8d | ||
|
|
52f3aca22d | ||
|
|
7464d8ac8f | ||
|
|
64fda38e2d | ||
|
|
4cefb62d41 | ||
|
|
ca45907af0 | ||
|
|
dcf43c7f2b | ||
|
|
1386ec3850 | ||
|
|
de8e16df15 | ||
|
|
222b2d4485 | ||
|
|
e107020bd2 | ||
|
|
430665e984 | ||
|
|
017d5673ba | ||
|
|
f346b9803e | ||
|
|
7428e08f93 | ||
|
|
3c8e6d7151 | ||
|
|
43bd2f4cdb | ||
|
|
1dfc9a88a8 | ||
|
|
01beba8697 | ||
|
|
b1e01b238b | ||
|
|
1f595da9ad | ||
|
|
1cf876927d | ||
|
|
a422c935d8 | ||
|
|
1971816663 | ||
|
|
3d1eab872b | ||
|
|
10c1b0c5fa | ||
|
|
4d95cd3630 | ||
|
|
0c169e96e5 | ||
|
|
5baea8400f | ||
|
|
4052cd4fd8 | ||
|
|
21ac400d49 | ||
|
|
351a4a48e4 | ||
|
|
b3cf475024 | ||
|
|
ded25075b1 |
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
.github
|
||||
docs
|
||||
examples
|
||||
functions
|
||||
hack
|
||||
site
|
||||
travis
|
||||
*.md
|
||||
31
Makefile
31
Makefile
@@ -47,35 +47,37 @@ $(MYGOBIN)/golangci-lint-kustomize:
|
||||
GO111MODULE=on go build -tags=tools -o $(MYGOBIN)/golangci-lint-kustomize github.com/golangci/golangci-lint/cmd/golangci-lint; \
|
||||
)
|
||||
|
||||
$(MYGOBIN)/gorepomod:
|
||||
cd api; \
|
||||
go install github.com/monopole/gorepomod
|
||||
|
||||
# Install from version specified in api/go.mod.
|
||||
$(MYGOBIN)/mdrip:
|
||||
cd api; \
|
||||
go install github.com/monopole/mdrip
|
||||
|
||||
# Install from version specified in api/go.mod.
|
||||
$(MYGOBIN)/stringer:
|
||||
cd api; \
|
||||
go install golang.org/x/tools/cmd/stringer
|
||||
|
||||
# Install from version specified in api/go.mod.
|
||||
$(MYGOBIN)/goimports:
|
||||
cd api; \
|
||||
go install golang.org/x/tools/cmd/goimports
|
||||
|
||||
# Install resource from whatever is checked out.
|
||||
$(MYGOBIN)/resource:
|
||||
cd cmd/resource; \
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/gorepomod:
|
||||
cd cmd/gorepomod; \
|
||||
go install .
|
||||
|
||||
# To pin pluginator, use this recipe instead:
|
||||
# cd api;
|
||||
# go install sigs.k8s.io/kustomize/pluginator/v2
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/pluginator:
|
||||
cd pluginator; \
|
||||
cd cmd/pluginator; \
|
||||
go install .
|
||||
|
||||
# Install kustomize from whatever is checked out.
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/prchecker:
|
||||
cd cmd/prchecker; \
|
||||
go install .
|
||||
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/kustomize:
|
||||
cd kustomize; \
|
||||
go install .
|
||||
@@ -88,6 +90,7 @@ install-tools: \
|
||||
$(MYGOBIN)/gorepomod \
|
||||
$(MYGOBIN)/mdrip \
|
||||
$(MYGOBIN)/pluginator \
|
||||
$(MYGOBIN)/prchecker \
|
||||
$(MYGOBIN)/stringer
|
||||
|
||||
### Begin kustomize plugin rules.
|
||||
@@ -190,8 +193,8 @@ lint-kustomize: install-tools $(builtinplugins)
|
||||
$(MYGOBIN)/golangci-lint-kustomize -c ../.golangci-kustomize.yml run ./...
|
||||
cd kustomize; \
|
||||
$(MYGOBIN)/golangci-lint-kustomize -c ../.golangci-kustomize.yml run ./...
|
||||
cd pluginator; \
|
||||
$(MYGOBIN)/golangci-lint-kustomize -c ../.golangci-kustomize.yml run ./...
|
||||
cd cmd/pluginator; \
|
||||
$(MYGOBIN)/golangci-lint-kustomize -c ../../.golangci-kustomize.yml run ./...
|
||||
|
||||
# Used to add non-default compilation flags when experimenting with
|
||||
# plugin-to-api compatibility checks.
|
||||
|
||||
@@ -17,8 +17,6 @@ require (
|
||||
k8s.io/apimachinery v0.17.0
|
||||
k8s.io/client-go v0.17.0
|
||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../kyaml
|
||||
|
||||
@@ -588,6 +588,8 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphD
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
|
||||
@@ -527,8 +527,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1 h1:5GRanVGU6+iq3ERTiQD9VIfyGByFVB4z4GthP8NkRYE=
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -21,5 +21,5 @@ import (
|
||||
// major version increments in pluginator with each
|
||||
// api release to allow this trick to work and not
|
||||
// introduce cycles.
|
||||
// _ "sigs.k8s.io/kustomize/pluginator/v2"
|
||||
// _ "sigs.k8s.io/kustomize/cmd/pluginator/v2"
|
||||
)
|
||||
|
||||
@@ -514,7 +514,7 @@ func anchorRegex(pattern string) string {
|
||||
if pattern == "" {
|
||||
return pattern
|
||||
}
|
||||
return "^" + pattern + "$"
|
||||
return "^(?:" + pattern + ")$"
|
||||
}
|
||||
|
||||
// Select returns a list of resources that
|
||||
|
||||
@@ -5,13 +5,17 @@ go 1.14
|
||||
require (
|
||||
github.com/go-errors/errors v1.0.1
|
||||
github.com/go-openapi/spec v0.19.5
|
||||
github.com/google/go-cmp v0.5.2 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.4
|
||||
github.com/posener/complete/v2 v2.0.1-alpha.12
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/stretchr/testify v1.6.1
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||
k8s.io/apimachinery v0.17.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../kyaml
|
||||
|
||||
@@ -33,6 +33,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -138,6 +139,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@@ -178,6 +181,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
@@ -205,6 +210,8 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
|
||||
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
|
||||
@@ -267,6 +274,8 @@ github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb/go.mod h1:a8OnR
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
@@ -295,6 +304,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -312,6 +322,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -330,6 +342,7 @@ golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c h1:Vco5b+cuG5NNfORVxZy6bYZQ7rsigisU1WQFkvQ0L5E=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
@@ -345,6 +358,9 @@ golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGm
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
@@ -354,6 +370,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
@@ -371,6 +389,8 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 h1:Xe2gvTZUJpsvOWUnvmL/tmhVBZUmHSvLbMjRj6NUUKo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/apimachinery v0.17.3 h1:f+uZV6rm4/tHE7xXgLyToprg6xWairaClGVkm2t8omg=
|
||||
k8s.io/apimachinery v0.17.3/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g=
|
||||
@@ -380,6 +400,8 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
|
||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU=
|
||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -70,6 +70,8 @@ func GetRunFnRunner(name string) *RunFnRunner {
|
||||
r.Command.Flags().StringArrayVarP(
|
||||
&r.Env, "env", "e", []string{},
|
||||
"a list of environment variables to be used by functions")
|
||||
r.Command.Flags().BoolVar(
|
||||
&r.AsCurrentUser, "as-current-user", false, "use the uid and gid that kpt is running with to run the function in the container")
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -97,6 +99,7 @@ type RunFnRunner struct {
|
||||
Mounts []string
|
||||
LogSteps bool
|
||||
Env []string
|
||||
AsCurrentUser bool
|
||||
}
|
||||
|
||||
func (r *RunFnRunner) runE(c *cobra.Command, args []string) error {
|
||||
@@ -312,6 +315,7 @@ func (r *RunFnRunner) preRunE(c *cobra.Command, args []string) error {
|
||||
ResultsDir: r.ResultsDir,
|
||||
LogSteps: r.LogSteps,
|
||||
Env: r.Env,
|
||||
AsCurrentUser: r.AsCurrentUser,
|
||||
}
|
||||
|
||||
// don't consider args for the function
|
||||
|
||||
@@ -300,6 +300,16 @@ apiVersion: v1
|
||||
Env: []string{"FOO=BAR", "BAR"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "as current user",
|
||||
args: []string{"run", "dir", "--as-current-user"},
|
||||
path: "dir",
|
||||
expectedStruct: &runfn.RunFns{
|
||||
Path: "dir",
|
||||
AsCurrentUser: true,
|
||||
Env: []string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i := range tests {
|
||||
|
||||
15
cmd/gorepomod/Makefile
Normal file
15
cmd/gorepomod/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
MYGOBIN := $(shell go env GOPATH)/bin
|
||||
|
||||
$(MYGOBIN)/gorepomod: usage.go
|
||||
go install .
|
||||
|
||||
.PHONY: test
|
||||
test: $(MYGOBIN)/gorepomod
|
||||
go test ./...
|
||||
|
||||
usage.go: README.md $(MYGOBIN)/goimports
|
||||
go generate . \
|
||||
$(MYGOBIN)/goimports -w usage.go
|
||||
|
||||
$(MYGOBIN)/goimports:
|
||||
go install golang.org/x/tools/cmd/goimports
|
||||
103
cmd/gorepomod/README.md
Normal file
103
cmd/gorepomod/README.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# gorepomod
|
||||
|
||||
Helps when you have a git repository with multiple Go modules.
|
||||
|
||||
It handles tasks one might otherwise attempt with
|
||||
|
||||
```
|
||||
find ./ -name "go.mod" | xargs {some hack}
|
||||
```
|
||||
|
||||
Run it from a git repository root.
|
||||
|
||||
It walks the repository, reads `go.mod` files, builds
|
||||
a model of Go modules and intra-repo module
|
||||
dependencies, then performs some operation.
|
||||
|
||||
Install:
|
||||
```
|
||||
go get sigs.k8s.io/kustomize/cmd/gorepomod
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
_Commands that change things (everything but `list`)
|
||||
do nothing but log commands
|
||||
unless you add the `--doIt` flag,
|
||||
allowing the change._
|
||||
|
||||
#### `gorepomod list`
|
||||
|
||||
Lists modules and intra-repo dependencies.
|
||||
|
||||
Use this to get module names for use in other commands.
|
||||
|
||||
#### `gorepomod tidy`
|
||||
|
||||
Creates a change with mechanical updates
|
||||
to `go.mod` and `go.sum` files.
|
||||
|
||||
#### `gorepomod unpin {module}`
|
||||
|
||||
Creates a change to `go.mod` files.
|
||||
|
||||
For each module _m_ in the repository,
|
||||
if _m_ depends on a _{module}_,
|
||||
then _m_'s dependency on it will be replaced by
|
||||
a relative path to the in-repo module.
|
||||
|
||||
#### `gorepomod pin {module} [{version}]`
|
||||
|
||||
Creates a change to `go.mod` files.
|
||||
|
||||
The opposite of `unpin`.
|
||||
|
||||
The change removes replacements and pins _m_ to a
|
||||
specific, previously tagged and released version of _{module}_.
|
||||
|
||||
The argument _{version}_ defaults to recent version of _{module}_.
|
||||
|
||||
_{version}_ should be in semver form, e.g. `v1.2.3`.
|
||||
|
||||
|
||||
#### `gorepomod release {module} [patch|minor|major]`
|
||||
|
||||
Computes a new version for the module, tags the repo
|
||||
with that version, and pushes the tag to the remote.
|
||||
|
||||
The value of the 2nd argument, either `patch` (the default),
|
||||
`minor` or `major`, determines the new version.
|
||||
|
||||
If the existing version is _v1.2.7_, then the new version will be:
|
||||
- `patch` -> _v1.2.8_
|
||||
- `minor` -> _v1.3.0_
|
||||
- `major` -> _v2.0.0_
|
||||
|
||||
After establishing the the version, the command looks for a branch named
|
||||
|
||||
> _release-{module}/-v{major}.{minor}_
|
||||
|
||||
If the branch doesn't exist, the command creates it and pushes it to the remote.
|
||||
|
||||
The command then creates a new tag in the form
|
||||
|
||||
> _{module}/v{major}.{minor}.{patch}_
|
||||
|
||||
The command pushes this tag to the remote. This typically triggers
|
||||
cloud activity to create release artifacts.
|
||||
|
||||
#### `gorepomod unrelease {module}`
|
||||
|
||||
This undoes the work of `release`, by deleting the
|
||||
most recent tag both locally and at the remote.
|
||||
|
||||
You can then fix whatever, and re-release.
|
||||
|
||||
This, however, must be done almost immediately.
|
||||
|
||||
If there's a chance someone (or some cloud robot) already
|
||||
imported the module at the given tag, then don't do this,
|
||||
because it will confuse module caches.
|
||||
|
||||
Do a new patch release instead.
|
||||
|
||||
5
cmd/gorepomod/go.mod
Normal file
5
cmd/gorepomod/go.mod
Normal file
@@ -0,0 +1,5 @@
|
||||
module sigs.k8s.io/kustomize/cmd/gorepomod
|
||||
|
||||
go 1.15
|
||||
|
||||
require golang.org/x/mod v0.3.0
|
||||
14
cmd/gorepomod/go.sum
Normal file
14
cmd/gorepomod/go.sum
Normal file
@@ -0,0 +1,14 @@
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
195
cmd/gorepomod/internal/arguments/args.go
Normal file
195
cmd/gorepomod/internal/arguments/args.go
Normal file
@@ -0,0 +1,195 @@
|
||||
package arguments
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
doItFlag = "--doIt"
|
||||
cmdPin = "pin"
|
||||
cmdUnPin = "unpin"
|
||||
cmdTidy = "tidy"
|
||||
cmdList = "list"
|
||||
cmdRelease = "release"
|
||||
cmdUnRelease = "unrelease"
|
||||
cmdDebug = "debug"
|
||||
)
|
||||
|
||||
var (
|
||||
commands = []string{
|
||||
cmdPin, cmdUnPin, cmdTidy, cmdList, cmdRelease, cmdUnRelease, cmdDebug}
|
||||
|
||||
// TODO: make this a PATH-like flag
|
||||
// e.g.: --excludes ".git:.idea:site:docs"
|
||||
excSlice = []string{
|
||||
".git",
|
||||
".github",
|
||||
".idea",
|
||||
"docs",
|
||||
"examples",
|
||||
"hack",
|
||||
"site",
|
||||
"releasing",
|
||||
}
|
||||
)
|
||||
|
||||
type Command int
|
||||
|
||||
const (
|
||||
Tidy Command = iota
|
||||
UnPin
|
||||
Pin
|
||||
List
|
||||
Release
|
||||
UnRelease
|
||||
Debug
|
||||
)
|
||||
|
||||
type Args struct {
|
||||
cmd Command
|
||||
moduleName misc.ModuleShortName
|
||||
version semver.SemVer
|
||||
bump semver.SvBump
|
||||
doIt bool
|
||||
}
|
||||
|
||||
func (a *Args) GetCommand() Command {
|
||||
return a.cmd
|
||||
}
|
||||
|
||||
func (a *Args) Bump() semver.SvBump {
|
||||
return a.bump
|
||||
}
|
||||
|
||||
func (a *Args) Version() semver.SemVer {
|
||||
return a.version
|
||||
}
|
||||
|
||||
func (a *Args) ModuleName() misc.ModuleShortName {
|
||||
return a.moduleName
|
||||
}
|
||||
|
||||
func (a *Args) Exclusions() (result []string) {
|
||||
// Make sure the list has no repeats.
|
||||
for k := range utils.SliceToSet(excSlice) {
|
||||
result = append(result, k)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Args) DoIt() bool {
|
||||
return a.doIt
|
||||
}
|
||||
|
||||
type myArgs struct {
|
||||
args []string
|
||||
doIt bool
|
||||
}
|
||||
|
||||
func (a *myArgs) next() (result string) {
|
||||
if !a.more() {
|
||||
panic("no args left")
|
||||
}
|
||||
result = a.args[0]
|
||||
a.args = a.args[1:]
|
||||
return
|
||||
}
|
||||
|
||||
func (a *myArgs) more() bool {
|
||||
return len(a.args) > 0
|
||||
}
|
||||
|
||||
func newArgs() *myArgs {
|
||||
result := &myArgs{}
|
||||
for _, a := range os.Args[1:] {
|
||||
if a == doItFlag {
|
||||
result.doIt = true
|
||||
} else {
|
||||
result.args = append(result.args, a)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func Parse() (result *Args, err error) {
|
||||
result = &Args{}
|
||||
clArgs := newArgs()
|
||||
result.doIt = clArgs.doIt
|
||||
|
||||
result.moduleName = misc.ModuleUnknown
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("command needs at least one arg")
|
||||
}
|
||||
command := clArgs.next()
|
||||
switch command {
|
||||
case cmdPin:
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("pin needs a moduleName to pin")
|
||||
}
|
||||
result.moduleName = misc.ModuleShortName(clArgs.next())
|
||||
if clArgs.more() {
|
||||
result.version, err = semver.Parse(clArgs.next())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
result.version = semver.Zero()
|
||||
}
|
||||
result.cmd = Pin
|
||||
case cmdUnPin:
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("unpin needs a moduleName to unpin")
|
||||
}
|
||||
result.moduleName = misc.ModuleShortName(clArgs.next())
|
||||
result.cmd = UnPin
|
||||
case cmdTidy:
|
||||
result.cmd = Tidy
|
||||
case cmdList:
|
||||
result.cmd = List
|
||||
case cmdRelease:
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("specify {module} to release")
|
||||
}
|
||||
result.moduleName = misc.ModuleShortName(clArgs.next())
|
||||
bump := "patch"
|
||||
if clArgs.more() {
|
||||
bump = clArgs.next()
|
||||
}
|
||||
switch bump {
|
||||
case "major":
|
||||
result.bump = semver.Major
|
||||
case "minor":
|
||||
result.bump = semver.Minor
|
||||
case "patch":
|
||||
result.bump = semver.Patch
|
||||
default:
|
||||
return nil, fmt.Errorf(
|
||||
"unknown bump %s; specify one of 'major', 'minor' or 'patch'", bump)
|
||||
}
|
||||
result.cmd = Release
|
||||
case cmdUnRelease:
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("specify {module} to unrelease")
|
||||
}
|
||||
result.moduleName = misc.ModuleShortName(clArgs.next())
|
||||
result.cmd = UnRelease
|
||||
case cmdDebug:
|
||||
if !clArgs.more() {
|
||||
return nil, fmt.Errorf("specify {module} to debug")
|
||||
}
|
||||
result.moduleName = misc.ModuleShortName(clArgs.next())
|
||||
result.cmd = Debug
|
||||
default:
|
||||
return nil, fmt.Errorf(
|
||||
"unknown command %q; must be one of %v", command, commands)
|
||||
}
|
||||
if clArgs.more() {
|
||||
return nil, fmt.Errorf("unknown extra args: %v", clArgs.args)
|
||||
}
|
||||
return
|
||||
}
|
||||
82
cmd/gorepomod/internal/edit/editor.go
Normal file
82
cmd/gorepomod/internal/edit/editor.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package edit
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
// Editor runs `go mod` commands on an instance of Module.
|
||||
// If doIt is false, the command is printed, but not run.
|
||||
type Editor struct {
|
||||
module misc.LaModule
|
||||
doIt bool
|
||||
}
|
||||
|
||||
func New(m misc.LaModule, doIt bool) *Editor {
|
||||
return &Editor{
|
||||
doIt: doIt,
|
||||
module: m,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Editor) run(args ...string) error {
|
||||
c := exec.Command(
|
||||
"go",
|
||||
append([]string{"mod"}, args...)...)
|
||||
c.Dir = string(e.module.ShortName())
|
||||
if e.doIt {
|
||||
out, err := c.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s out=%q", err.Error(), out)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("in %-60s; %s\n", c.Dir, c.String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func upstairs(depth int) string {
|
||||
var b strings.Builder
|
||||
for i := 0; i < depth; i++ {
|
||||
b.WriteString("../")
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func (e *Editor) Tidy() error {
|
||||
return e.run("tidy")
|
||||
}
|
||||
|
||||
func (e *Editor) Pin(target misc.LaModule, oldV, newV semver.SemVer) error {
|
||||
err := e.run(
|
||||
"edit",
|
||||
"-dropreplace="+target.ImportPath()+"@"+oldV.String(),
|
||||
"-require="+target.ImportPath()+"@"+newV.String(),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.run("tidy")
|
||||
}
|
||||
|
||||
func (e *Editor) UnPin(target misc.LaModule, oldV semver.SemVer) error {
|
||||
var r strings.Builder
|
||||
r.WriteString(target.ImportPath())
|
||||
r.WriteString("@")
|
||||
r.WriteString(oldV.String())
|
||||
r.WriteString("=")
|
||||
r.WriteString(upstairs(e.module.ShortName().Depth()))
|
||||
r.WriteString(string(target.ShortName()))
|
||||
err := e.run(
|
||||
"edit",
|
||||
"-replace="+r.String(),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.run("tidy")
|
||||
}
|
||||
32
cmd/gorepomod/internal/edit/editor_test.go
Normal file
32
cmd/gorepomod/internal/edit/editor_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package edit
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUpstairs(t *testing.T) {
|
||||
var testCases = map[string]struct {
|
||||
depth int
|
||||
expected string
|
||||
}{
|
||||
"zero": {
|
||||
depth: 0,
|
||||
expected: "",
|
||||
},
|
||||
"one": {
|
||||
depth: 1,
|
||||
expected: "../",
|
||||
},
|
||||
"five": {
|
||||
depth: 5,
|
||||
expected: "../../../../../",
|
||||
},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
if tc.expected != upstairs(tc.depth) {
|
||||
t.Fatalf(
|
||||
"%s: for depth %d, expected %q, got %q",
|
||||
n, tc.depth, tc.expected, upstairs(tc.depth))
|
||||
}
|
||||
}
|
||||
}
|
||||
75
cmd/gorepomod/internal/gen/main.go
Normal file
75
cmd/gorepomod/internal/gen/main.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
inputFile = "README.md"
|
||||
outputFile = "usage.go"
|
||||
)
|
||||
|
||||
// Convert README.md to a usage function.
|
||||
func main() {
|
||||
inFile, err := os.Open(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer inFile.Close()
|
||||
scanner := bufio.NewScanner(inFile)
|
||||
|
||||
w := NewWriter(outputFile)
|
||||
w.prLn("// Code generated by internal/gen/main.go; DO NOT EDIT.")
|
||||
w.prLn("package main")
|
||||
w.prLn("")
|
||||
w.prLn("")
|
||||
w.prLn("const (")
|
||||
w.prLn(" usageMsg = `")
|
||||
|
||||
// Skip the first two lines.
|
||||
scanner.Scan()
|
||||
scanner.Scan()
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
line = strings.Replace(line, "`", "'", -1)
|
||||
line = strings.Replace(line, "\\[", "[", -1)
|
||||
line = strings.Replace(line, "\\]", "]", -1)
|
||||
w.prLn(line)
|
||||
}
|
||||
w.prLn("`")
|
||||
w.prLn(")")
|
||||
w.close()
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
type writer struct {
|
||||
f *os.File
|
||||
}
|
||||
|
||||
func NewWriter(n string) *writer {
|
||||
f, err := os.Create(n)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to create `%s`; %v", n, err)
|
||||
}
|
||||
return &writer{f: f}
|
||||
}
|
||||
|
||||
func (w *writer) prLn(line string) {
|
||||
_, err := w.f.WriteString(line + "\n")
|
||||
if err != nil {
|
||||
log.Printf("Trouble writing: %s", line)
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *writer) close() {
|
||||
if err := w.f.Close(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
340
cmd/gorepomod/internal/git/runner.go
Normal file
340
cmd/gorepomod/internal/git/runner.go
Normal file
@@ -0,0 +1,340 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
const (
|
||||
refsTags = "refs/tags/"
|
||||
pathSep = "/"
|
||||
remoteOrigin = misc.TrackedRepo("origin")
|
||||
remoteUpstream = misc.TrackedRepo("upstream")
|
||||
mainBranch = "master"
|
||||
indent = " "
|
||||
doing = " [x] "
|
||||
faking = " [ ] "
|
||||
)
|
||||
|
||||
type safetyLevel int
|
||||
|
||||
const (
|
||||
// Commands that don't hurt, e.g. checking out an existing branch.
|
||||
noHarmDone safetyLevel = iota
|
||||
// Commands that write, and could be hard to undo.
|
||||
undoPainful
|
||||
)
|
||||
|
||||
type Verbosity int
|
||||
|
||||
const (
|
||||
Low Verbosity = iota
|
||||
High
|
||||
)
|
||||
|
||||
var recognizedRemotes = []misc.TrackedRepo{remoteUpstream, remoteOrigin}
|
||||
|
||||
// Runner runs specific git tasks using the git CLI.
|
||||
type Runner struct {
|
||||
// From which directory do we run the commands.
|
||||
workDir string
|
||||
// Run commands, or merely print commands.
|
||||
doIt bool
|
||||
// Run commands, or merely print commands.
|
||||
verbosity Verbosity
|
||||
}
|
||||
|
||||
func NewLoud(wd string, doIt bool) *Runner {
|
||||
return newRunner(wd, doIt, High)
|
||||
}
|
||||
|
||||
func NewQuiet(wd string, doIt bool) *Runner {
|
||||
return newRunner(wd, doIt, Low)
|
||||
}
|
||||
|
||||
func newRunner(wd string, doIt bool, v Verbosity) *Runner {
|
||||
return &Runner{workDir: wd, doIt: doIt, verbosity: v}
|
||||
}
|
||||
|
||||
func (gr *Runner) comment(f string) {
|
||||
if gr.verbosity == Low {
|
||||
return
|
||||
}
|
||||
fmt.Print(indent)
|
||||
fmt.Println(f)
|
||||
}
|
||||
|
||||
func (gr *Runner) doing(s string) {
|
||||
if gr.verbosity == Low {
|
||||
return
|
||||
}
|
||||
fmt.Print(indent)
|
||||
fmt.Print(doing)
|
||||
fmt.Println(s)
|
||||
}
|
||||
|
||||
func (gr *Runner) faking(s string) {
|
||||
if gr.verbosity == Low {
|
||||
return
|
||||
}
|
||||
fmt.Print(indent)
|
||||
fmt.Print(faking)
|
||||
fmt.Println(s)
|
||||
}
|
||||
|
||||
func (gr *Runner) run(sl safetyLevel, args ...string) (string, error) {
|
||||
c := exec.Command("git", args...)
|
||||
c.Dir = gr.workDir
|
||||
if gr.doIt || sl == noHarmDone {
|
||||
gr.doing(c.String())
|
||||
out, err := c.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf(
|
||||
"%s out=%q", err.Error(), strings.TrimSpace(string(out)))
|
||||
}
|
||||
return string(out), nil
|
||||
}
|
||||
gr.faking(c.String())
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (gr *Runner) runNoOut(s safetyLevel, args ...string) error {
|
||||
_, err := gr.run(s, args...)
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: allow for other remote names.
|
||||
func (gr *Runner) DetermineRemoteToUse() (misc.TrackedRepo, error) {
|
||||
gr.comment("determining remote to use")
|
||||
out, err := gr.run(noHarmDone, "remote")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
remotes := strings.Split(out, "\n")
|
||||
if len(remotes) < 1 {
|
||||
return "", fmt.Errorf("need at least one remote")
|
||||
}
|
||||
for _, n := range recognizedRemotes {
|
||||
if contains(remotes, n) {
|
||||
return n, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf(
|
||||
"unable to find recognized remote %v", recognizedRemotes)
|
||||
}
|
||||
|
||||
func contains(list []string, item misc.TrackedRepo) bool {
|
||||
for _, n := range list {
|
||||
if n == string(item) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (gr *Runner) LoadLocalTags() (result misc.VersionMap, err error) {
|
||||
gr.comment("loading local tags")
|
||||
var out string
|
||||
out, err = gr.run(noHarmDone, "tag", "-l")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = make(misc.VersionMap)
|
||||
lines := strings.Split(out, "\n")
|
||||
for _, l := range lines {
|
||||
n, v, err := parseModuleSpec(l)
|
||||
if err != nil {
|
||||
// ignore it
|
||||
continue
|
||||
}
|
||||
result[n] = append(result[n], v)
|
||||
}
|
||||
for _, versions := range result {
|
||||
sort.Sort(versions)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (gr *Runner) LoadRemoteTags(
|
||||
remote misc.TrackedRepo) (result misc.VersionMap, err error) {
|
||||
gr.comment("loading remote tags")
|
||||
var out string
|
||||
out, err = gr.run(noHarmDone, "ls-remote", "--ref", string(remote))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = make(misc.VersionMap)
|
||||
lines := strings.Split(out, "\n")
|
||||
for _, l := range lines {
|
||||
fields := strings.Fields(l)
|
||||
if len(fields) < 2 {
|
||||
// ignore it
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(fields[1], refsTags) {
|
||||
// ignore it
|
||||
continue
|
||||
}
|
||||
path := fields[1][len(refsTags):]
|
||||
n, v, err := parseModuleSpec(path)
|
||||
if err != nil {
|
||||
// ignore it
|
||||
continue
|
||||
}
|
||||
result[n] = append(result[n], v)
|
||||
}
|
||||
for _, versions := range result {
|
||||
sort.Sort(versions)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func parseModuleSpec(
|
||||
path string) (n misc.ModuleShortName, v semver.SemVer, err error) {
|
||||
fields := strings.Split(path, pathSep)
|
||||
v, err = semver.Parse(fields[len(fields)-1])
|
||||
if err != nil {
|
||||
// Silently ignore versions we don't understand.
|
||||
return "", v, err
|
||||
}
|
||||
n = misc.ModuleAtTop
|
||||
if len(fields) > 1 {
|
||||
n = misc.ModuleShortName(
|
||||
strings.Join(fields[:len(fields)-1], pathSep))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (gr *Runner) Debug(remote misc.TrackedRepo) error {
|
||||
return nil // gr.CheckoutMainBranch(remote)
|
||||
}
|
||||
|
||||
func (gr *Runner) AssureCleanWorkspace() error {
|
||||
gr.comment("assuring a clean workspace")
|
||||
out, err := gr.run(noHarmDone, "status")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !strings.Contains(out, "nothing to commit, working tree clean") {
|
||||
return fmt.Errorf("the workspace isn't clean")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gr *Runner) AssureOnMainBranch() error {
|
||||
gr.comment("assuring main branch checked out")
|
||||
out, err := gr.run(noHarmDone, "status")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !strings.Contains(out, "On branch "+mainBranch) {
|
||||
return fmt.Errorf("expected to be on branch %q", mainBranch)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckoutMainBranch does that.
|
||||
func (gr *Runner) CheckoutMainBranch() error {
|
||||
gr.comment("checking out main branch")
|
||||
return gr.runNoOut(noHarmDone, "checkout", mainBranch)
|
||||
}
|
||||
|
||||
// FetchRemote does that.
|
||||
func (gr *Runner) FetchRemote(remote misc.TrackedRepo) error {
|
||||
gr.comment("fetching remote")
|
||||
return gr.runNoOut(noHarmDone, "fetch", string(remote))
|
||||
}
|
||||
|
||||
// MergeFromRemoteMain does a fast forward only merge with main branch.
|
||||
func (gr *Runner) MergeFromRemoteMain(remote misc.TrackedRepo) error {
|
||||
remo := strings.Join(
|
||||
[]string{string(remote), mainBranch}, pathSep)
|
||||
gr.comment("merging from remote")
|
||||
return gr.runNoOut(undoPainful, "merge", "--ff-only", remo)
|
||||
}
|
||||
|
||||
// CheckoutReleaseBranch attempts to checkout or create a branch.
|
||||
// If it's on the remote already, fail if we cannot check it out locally.
|
||||
func (gr *Runner) CheckoutReleaseBranch(
|
||||
remote misc.TrackedRepo, branch string) error {
|
||||
yes, err := gr.doesRemoteBranchExist(remote, branch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if yes {
|
||||
gr.comment("checking out branch")
|
||||
if out, err := gr.run(noHarmDone, "checkout", branch); err != nil {
|
||||
fmt.Printf("error with checkout: %q", err.Error())
|
||||
fmt.Printf("out: %q", out)
|
||||
return fmt.Errorf(
|
||||
"branch %q exists on remote %q, but isn't present locally",
|
||||
branch, string(remote))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
gr.comment("creating branch")
|
||||
// The branch doesn't exist. Create it.
|
||||
out, err := gr.run(noHarmDone, "checkout", "-b", branch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !strings.Contains(out, "Switched to a new branch ") {
|
||||
return fmt.Errorf("unexpected branch creation output: %q", out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gr *Runner) doesRemoteBranchExist(
|
||||
remote misc.TrackedRepo, branch string) (bool, error) {
|
||||
gr.comment("looking for branch on remote")
|
||||
out, err := gr.run(noHarmDone, "branch", "-r")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
lookFor := strings.Join([]string{string(remote), branch}, pathSep)
|
||||
lines := strings.Split(out, "\n")
|
||||
for _, l := range lines {
|
||||
if strings.TrimSpace(l) == lookFor {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (gr *Runner) PushBranchToRemote(
|
||||
remote misc.TrackedRepo, branch string) error {
|
||||
gr.comment("pushing branch to remote")
|
||||
return gr.runNoOut(undoPainful, "push", "-f", string(remote), branch)
|
||||
}
|
||||
|
||||
func (gr *Runner) CreateLocalReleaseTag(tag, branch string) error {
|
||||
msg := fmt.Sprintf("\"Release %s on branch %s\"", tag, branch)
|
||||
gr.comment("creating local release tag")
|
||||
return gr.runNoOut(
|
||||
undoPainful,
|
||||
"tag", "-a",
|
||||
"-m", msg,
|
||||
tag)
|
||||
}
|
||||
|
||||
func (gr *Runner) DeleteLocalTag(tag string) error {
|
||||
gr.comment("deleting local tag")
|
||||
return gr.runNoOut(undoPainful, "tag", "--delete", tag)
|
||||
}
|
||||
|
||||
func (gr *Runner) PushTagToRemote(
|
||||
remote misc.TrackedRepo, tag string) error {
|
||||
gr.comment("pushing tag to remote")
|
||||
return gr.runNoOut(undoPainful, "push", string(remote), tag)
|
||||
}
|
||||
|
||||
func (gr *Runner) DeleteTagFromRemote(
|
||||
remote misc.TrackedRepo, tag string) error {
|
||||
gr.comment("deleting tags from remote")
|
||||
return gr.runNoOut(undoPainful, "push", string(remote), ":"+refsTags+tag)
|
||||
}
|
||||
126
cmd/gorepomod/internal/misc/interfaces.go
Normal file
126
cmd/gorepomod/internal/misc/interfaces.go
Normal file
@@ -0,0 +1,126 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
// ModFunc is a function accepting a module, and returning an error.
|
||||
type ModFunc func(LaModule) error
|
||||
|
||||
type LaRepository interface {
|
||||
// RepoPath is the import of the of repository,
|
||||
// e.g. github.com/kubernetes-sigs/kustomize
|
||||
// The directory {srcRoot}/{importPath} should contain a
|
||||
// dotGit directory.
|
||||
// This directory might be a Go module, or contain directories
|
||||
// that are Go modules, or both.
|
||||
RepoPath() string
|
||||
|
||||
// AbsPath is the full local filesystem path.
|
||||
AbsPath() string
|
||||
|
||||
// FindModule returns a module or nil.
|
||||
FindModule(ModuleShortName) LaModule
|
||||
}
|
||||
|
||||
type LaModule interface {
|
||||
// ShortName is the module's name without the repo.
|
||||
ShortName() ModuleShortName
|
||||
|
||||
// ImportPath is the relative path below the Go src root,
|
||||
// which is the same path as would be used to
|
||||
// import the module.
|
||||
ImportPath() string
|
||||
|
||||
// AbsPath is the absolute path to the module's
|
||||
// go.mod file on the local file system.
|
||||
AbsPath() string
|
||||
|
||||
// Latest version tagged locally.
|
||||
VersionLocal() semver.SemVer
|
||||
|
||||
// Latest version tagged remotely.
|
||||
VersionRemote() semver.SemVer
|
||||
|
||||
// Does this module depend on the argument, and
|
||||
// if so at what version?
|
||||
DependsOn(LaModule) (bool, semver.SemVer)
|
||||
|
||||
// GetReplacements returns a list of replacements.
|
||||
GetReplacements() []string
|
||||
}
|
||||
|
||||
// VersionMap holds the versions associated with modules.
|
||||
type VersionMap map[ModuleShortName]semver.Versions
|
||||
|
||||
func (m VersionMap) Report() {
|
||||
for n, versions := range m {
|
||||
fmt.Println(n)
|
||||
for _, v := range versions {
|
||||
fmt.Print(" ")
|
||||
fmt.Println(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m VersionMap) Latest(
|
||||
n ModuleShortName) semver.SemVer {
|
||||
versions := m[n]
|
||||
if versions == nil {
|
||||
return semver.Zero()
|
||||
}
|
||||
return versions[0]
|
||||
}
|
||||
|
||||
type LesModules []LaModule
|
||||
|
||||
func (s LesModules) LenLongestName() (ans int) {
|
||||
for _, m := range s {
|
||||
l := len(m.ShortName())
|
||||
if l > ans {
|
||||
ans = l
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s LesModules) Apply(f ModFunc) error {
|
||||
for _, m := range s {
|
||||
err := f(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s LesModules) Find(target ModuleShortName) LaModule {
|
||||
for _, m := range s {
|
||||
if m.ShortName() == target {
|
||||
return m
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s LesModules) GetAllThatDependOn(
|
||||
target LaModule) (result TaggedModules) {
|
||||
for _, m := range s {
|
||||
if yes, v := m.DependsOn(target); yes {
|
||||
result = append(result, TaggedModule{M: m, V: v})
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s LesModules) InternalDeps(
|
||||
target LaModule) (result TaggedModules) {
|
||||
for _, m := range s {
|
||||
if yes, v := target.DependsOn(m); yes {
|
||||
result = append(result, TaggedModule{M: m, V: v})
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
23
cmd/gorepomod/internal/misc/moduleshortname.go
Normal file
23
cmd/gorepomod/internal/misc/moduleshortname.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ModuleShortName is the in-repo path to the directory holding the module
|
||||
// (holding the go.mod file). It's the unique in-repo name of the module.
|
||||
// It's the name used to tag the repo at a particular module version.
|
||||
// E.g. "" (empty), "kyaml", "cmd/config", "plugin/example/whatever".
|
||||
type ModuleShortName string
|
||||
|
||||
// Never used in a tag.
|
||||
const ModuleAtTop = ModuleShortName("{top}")
|
||||
const ModuleUnknown = ModuleShortName("{unknown}")
|
||||
|
||||
func (m ModuleShortName) Depth() int {
|
||||
if m == ModuleAtTop || m == ModuleUnknown {
|
||||
return 0
|
||||
}
|
||||
return strings.Count(string(m), string(filepath.Separator)) + 1
|
||||
}
|
||||
36
cmd/gorepomod/internal/misc/moduleshortname_test.go
Normal file
36
cmd/gorepomod/internal/misc/moduleshortname_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package misc_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
)
|
||||
|
||||
func TestDepth(t *testing.T) {
|
||||
var testCases = map[string]struct {
|
||||
path string
|
||||
expectedDepth int
|
||||
}{
|
||||
"zero": {
|
||||
path: "{top}",
|
||||
expectedDepth: 0,
|
||||
},
|
||||
"one": {
|
||||
path: "one",
|
||||
expectedDepth: 1,
|
||||
},
|
||||
"three": {
|
||||
path: "one/two/three",
|
||||
expectedDepth: 3,
|
||||
},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
m := misc.ModuleShortName(tc.path)
|
||||
d := m.Depth()
|
||||
if d != tc.expectedDepth {
|
||||
t.Fatalf(
|
||||
"%s: %s, expected %d, got %d",
|
||||
n, tc.path, tc.expectedDepth, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
42
cmd/gorepomod/internal/misc/taggedmodule.go
Normal file
42
cmd/gorepomod/internal/misc/taggedmodule.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
// TaggedModule is a module known to be tagged with the given version.
|
||||
type TaggedModule struct {
|
||||
M LaModule
|
||||
V semver.SemVer
|
||||
}
|
||||
|
||||
func (p TaggedModule) String() string {
|
||||
if p.V.IsZero() {
|
||||
return string(p.M.ShortName())
|
||||
}
|
||||
return string(p.M.ShortName()) + "/" + p.V.String()
|
||||
}
|
||||
|
||||
type TaggedModules []TaggedModule
|
||||
|
||||
func (s TaggedModules) String() string {
|
||||
// format := "%-"+strconv.Itoa(s.LenLongestString()+2)+"s"
|
||||
var b strings.Builder
|
||||
for i := range s {
|
||||
b.WriteString(fmt.Sprintf("%-15s", s[i]))
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func (s TaggedModules) LenLongestString() (ans int) {
|
||||
for _, m := range s {
|
||||
l := len(m.String())
|
||||
if l > ans {
|
||||
ans = l
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
4
cmd/gorepomod/internal/misc/trackedrepo.go
Normal file
4
cmd/gorepomod/internal/misc/trackedrepo.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package misc
|
||||
|
||||
// TrackedRepo identifies a git remote repository.
|
||||
type TrackedRepo string
|
||||
79
cmd/gorepomod/internal/mod/module.go
Normal file
79
cmd/gorepomod/internal/mod/module.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package mod
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"golang.org/x/mod/modfile"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
// Module is an immutable representation of a Go module.
|
||||
type Module struct {
|
||||
repo misc.LaRepository
|
||||
shortName misc.ModuleShortName
|
||||
mf *modfile.File
|
||||
vLocal semver.SemVer
|
||||
vRemote semver.SemVer
|
||||
}
|
||||
|
||||
func New(
|
||||
repo misc.LaRepository,
|
||||
shortName misc.ModuleShortName,
|
||||
mf *modfile.File,
|
||||
vl semver.SemVer,
|
||||
vr semver.SemVer) *Module {
|
||||
return &Module{
|
||||
repo: repo,
|
||||
shortName: shortName,
|
||||
mf: mf,
|
||||
vLocal: vl,
|
||||
vRemote: vr,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Module) GitRepo() misc.LaRepository {
|
||||
return m.repo
|
||||
}
|
||||
|
||||
func (m *Module) VersionLocal() semver.SemVer {
|
||||
return m.vLocal
|
||||
}
|
||||
|
||||
func (m *Module) VersionRemote() semver.SemVer {
|
||||
return m.vRemote
|
||||
}
|
||||
|
||||
func (m *Module) ShortName() misc.ModuleShortName {
|
||||
return m.shortName
|
||||
}
|
||||
|
||||
func (m *Module) ImportPath() string {
|
||||
return filepath.Join(m.repo.RepoPath(), string(m.ShortName()))
|
||||
}
|
||||
|
||||
func (m *Module) AbsPath() string {
|
||||
return filepath.Join(m.repo.AbsPath(), string(m.ShortName()))
|
||||
}
|
||||
|
||||
func (m *Module) DependsOn(target misc.LaModule) (bool, semver.SemVer) {
|
||||
for _, r := range m.mf.Require {
|
||||
if r.Mod.Path == target.ImportPath() {
|
||||
v, err := semver.Parse(r.Mod.Version)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return true, v
|
||||
}
|
||||
}
|
||||
return false, semver.Zero()
|
||||
}
|
||||
|
||||
func (m *Module) GetReplacements() (result []string) {
|
||||
for _, r := range m.mf.Replace {
|
||||
result = append(
|
||||
result, fmt.Sprintf("%s => %s", r.Old.String(), r.New.String()))
|
||||
}
|
||||
return
|
||||
}
|
||||
1
cmd/gorepomod/internal/mod/module_test.go
Normal file
1
cmd/gorepomod/internal/mod/module_test.go
Normal file
@@ -0,0 +1 @@
|
||||
package mod_test
|
||||
134
cmd/gorepomod/internal/repo/dotgitdata.go
Normal file
134
cmd/gorepomod/internal/repo/dotgitdata.go
Normal file
@@ -0,0 +1,134 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/git"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
dotGitFileName = ".git"
|
||||
srcHint = "/src/"
|
||||
goModFile = "go.mod"
|
||||
)
|
||||
|
||||
// DotGitData holds basic information about a local .git file
|
||||
type DotGitData struct {
|
||||
// srcPath is the absolute path to the local Go src directory.
|
||||
// This used to be $GOPATH/src.
|
||||
// It's the directory containing git repository clones.
|
||||
srcPath string
|
||||
// The path below srcPath to a particular repository
|
||||
// directory, a directory containing a .git directory.
|
||||
// Typically {repoOrg}/{repoUserName}, e.g. sigs.k8s.io/cli-utils
|
||||
repoPath string
|
||||
}
|
||||
|
||||
func (dg *DotGitData) SrcPath() string {
|
||||
return dg.srcPath
|
||||
}
|
||||
|
||||
func (dg *DotGitData) RepoPath() string {
|
||||
return dg.repoPath
|
||||
}
|
||||
|
||||
func (dg *DotGitData) AbsPath() string {
|
||||
return filepath.Join(dg.srcPath, dg.repoPath)
|
||||
}
|
||||
|
||||
// NewDotGitDataFromPath wants the incoming path to hold dotGit
|
||||
// E.g.
|
||||
// ~/gopath/src/sigs.k8s.io/kustomize
|
||||
// ~/gopath/src/github.com/monopole/gorepomod
|
||||
func NewDotGitDataFromPath(path string) (*DotGitData, error) {
|
||||
if !utils.DirExists(filepath.Join(path, dotGitFileName)) {
|
||||
return nil, fmt.Errorf(
|
||||
"%q doesn't have a %q file", path, dotGitFileName)
|
||||
}
|
||||
// This is an attempt to figure out where the user has cloned
|
||||
// their repos. In the old days, it was an import path under
|
||||
// $GOPATH/src. If we cannot guess it, we may need to ask for it,
|
||||
// or maybe proceed without knowing it.
|
||||
index := strings.Index(path, srcHint)
|
||||
if index < 0 {
|
||||
return nil, fmt.Errorf(
|
||||
"path %q doesn't contain %q", path, srcHint)
|
||||
}
|
||||
return &DotGitData{
|
||||
srcPath: path[:index+len(srcHint)-1],
|
||||
repoPath: path[index+len(srcHint):],
|
||||
}, nil
|
||||
}
|
||||
|
||||
// It's a factory factory.
|
||||
func (dg *DotGitData) NewRepoFactory(
|
||||
exclusions []string) (*ManagerFactory, error) {
|
||||
modules, err := loadProtoModules(dg.AbsPath(), exclusions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = dg.checkModules(modules)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
runner := git.NewQuiet(dg.AbsPath(), true)
|
||||
remoteName, err := runner.DetermineRemoteToUse()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Some tags might exist for modules that
|
||||
// have been renamed or deleted; ignore those.
|
||||
// There might be newer tags locally than remote,
|
||||
// so report both.
|
||||
localTags, err := runner.LoadLocalTags()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
remoteTags, err := runner.LoadRemoteTags(remoteName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ManagerFactory{
|
||||
dg: dg,
|
||||
modules: modules,
|
||||
remoteName: remoteName,
|
||||
versionMapLocal: localTags,
|
||||
versionMapRemote: remoteTags,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (dg *DotGitData) checkModules(modules []*protoModule) error {
|
||||
for _, pm := range modules {
|
||||
|
||||
file := filepath.Join(pm.PathToGoMod(), goModFile)
|
||||
|
||||
// Do the paths make sense?
|
||||
if !strings.HasPrefix(pm.FullPath(), dg.RepoPath()) {
|
||||
return fmt.Errorf(
|
||||
"module %q doesn't start with the repository name %q",
|
||||
pm.FullPath(), dg.RepoPath())
|
||||
}
|
||||
|
||||
shortName := pm.ShortName(dg.RepoPath())
|
||||
if shortName == misc.ModuleAtTop {
|
||||
if pm.PathToGoMod() != dg.AbsPath() {
|
||||
return fmt.Errorf("in %q, problem with top module", file)
|
||||
}
|
||||
} else {
|
||||
// Do the relative path and short name make sense?
|
||||
if !strings.HasSuffix(pm.PathToGoMod(), string(shortName)) {
|
||||
return fmt.Errorf(
|
||||
"in %q, the module name %q doesn't match the file's pathToGoMod %q",
|
||||
file, shortName, pm.PathToGoMod())
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
6
cmd/gorepomod/internal/repo/dotgitdata_test.go
Normal file
6
cmd/gorepomod/internal/repo/dotgitdata_test.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package repo
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLoadTags(t *testing.T) {
|
||||
}
|
||||
194
cmd/gorepomod/internal/repo/manager.go
Normal file
194
cmd/gorepomod/internal/repo/manager.go
Normal file
@@ -0,0 +1,194 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/edit"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/git"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
)
|
||||
|
||||
// Manager manages a git repo.
|
||||
// All data already loaded and validated, it's ready to go.
|
||||
type Manager struct {
|
||||
// Underlying file system facts.
|
||||
dg *DotGitData
|
||||
|
||||
// The remote used for fetching tags, pushing tags,
|
||||
// and pushing release branches.
|
||||
remoteName misc.TrackedRepo
|
||||
|
||||
// The list of known Go modules in the repo.
|
||||
modules misc.LesModules
|
||||
}
|
||||
|
||||
func (mgr *Manager) AbsPath() string {
|
||||
return mgr.dg.AbsPath()
|
||||
}
|
||||
|
||||
func (mgr *Manager) RepoPath() string {
|
||||
return mgr.dg.RepoPath()
|
||||
}
|
||||
|
||||
func (mgr *Manager) FindModule(
|
||||
target misc.ModuleShortName) misc.LaModule {
|
||||
return mgr.modules.Find(target)
|
||||
}
|
||||
|
||||
func (mgr *Manager) Tidy(doIt bool) error {
|
||||
return mgr.modules.Apply(func(m misc.LaModule) error {
|
||||
return edit.New(m, doIt).Tidy()
|
||||
})
|
||||
}
|
||||
|
||||
func (mgr *Manager) Pin(
|
||||
doIt bool, target misc.LaModule, newV semver.SemVer) error {
|
||||
return mgr.modules.Apply(func(m misc.LaModule) error {
|
||||
if yes, oldVersion := m.DependsOn(target); yes {
|
||||
return edit.New(m, doIt).Pin(target, oldVersion, newV)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (mgr *Manager) UnPin(doIt bool, target misc.LaModule) error {
|
||||
return mgr.modules.Apply(func(m misc.LaModule) error {
|
||||
if yes, oldVersion := m.DependsOn(target); yes {
|
||||
return edit.New(m, doIt).UnPin(target, oldVersion)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func hasUnPinnedDeps(m misc.LaModule) string {
|
||||
if len(m.GetReplacements()) > 0 {
|
||||
return "yes"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (mgr *Manager) List() error {
|
||||
fmt.Printf(" src path: %s\n", mgr.dg.SrcPath())
|
||||
fmt.Printf(" repo path: %s\n", mgr.RepoPath())
|
||||
fmt.Printf(" remote: %s\n", mgr.remoteName)
|
||||
format := "%-" +
|
||||
strconv.Itoa(mgr.modules.LenLongestName()+2) +
|
||||
"s%-11s%-11s%17s %s\n"
|
||||
fmt.Printf(
|
||||
format, "NAME", "LOCAL", "REMOTE",
|
||||
"HAS-UNPINNED-DEPS", "INTRA-REPO-DEPENDENCIES")
|
||||
return mgr.modules.Apply(func(m misc.LaModule) error {
|
||||
fmt.Printf(
|
||||
format, m.ShortName(),
|
||||
m.VersionLocal().Pretty(),
|
||||
m.VersionRemote().Pretty(),
|
||||
hasUnPinnedDeps(m),
|
||||
mgr.modules.InternalDeps(m))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func determineBranchAndTag(
|
||||
m misc.LaModule, v semver.SemVer) (string, string) {
|
||||
if m.ShortName() == misc.ModuleAtTop {
|
||||
return fmt.Sprintf("release-%s", v.BranchLabel()), v.String()
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"release-%s-%s", m.ShortName(), v.BranchLabel()),
|
||||
string(m.ShortName()) + "/" + v.String()
|
||||
}
|
||||
|
||||
func (mgr *Manager) Debug(_ misc.LaModule, doIt bool) error {
|
||||
gr := git.NewLoud(mgr.AbsPath(), doIt)
|
||||
return gr.Debug(mgr.remoteName)
|
||||
}
|
||||
|
||||
// Release supports a gitlab flow style release process.
|
||||
//
|
||||
// * All development happens in the branch named "master".
|
||||
// * Each minor release gets its own branch.
|
||||
// *
|
||||
func (mgr *Manager) Release(
|
||||
target misc.LaModule, bump semver.SvBump, doIt bool) error {
|
||||
|
||||
if reps := target.GetReplacements(); len(reps) > 0 {
|
||||
return fmt.Errorf(
|
||||
"to release %q, first pin these replacements: %v",
|
||||
target.ShortName(), reps)
|
||||
}
|
||||
|
||||
newVersion := target.VersionLocal().Bump(bump)
|
||||
|
||||
if newVersion.Equals(target.VersionRemote()) {
|
||||
return fmt.Errorf(
|
||||
"version %s already exists on remote - delete it first", newVersion)
|
||||
}
|
||||
if newVersion.LessThan(target.VersionRemote()) {
|
||||
fmt.Printf(
|
||||
"version %s is less than the most recent remote version (%s)",
|
||||
newVersion, target.VersionRemote())
|
||||
}
|
||||
|
||||
gr := git.NewLoud(mgr.AbsPath(), doIt)
|
||||
|
||||
relBranch, relTag := determineBranchAndTag(target, newVersion)
|
||||
|
||||
fmt.Printf(
|
||||
"Releasing %s, stepping from %s to %s\n",
|
||||
target.ShortName(), target.VersionLocal(), newVersion)
|
||||
|
||||
if err := gr.AssureCleanWorkspace(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.FetchRemote(mgr.remoteName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.CheckoutMainBranch(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.MergeFromRemoteMain(mgr.remoteName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.AssureCleanWorkspace(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.CheckoutReleaseBranch(mgr.remoteName, relBranch); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.MergeFromRemoteMain(mgr.remoteName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.PushBranchToRemote(mgr.remoteName, relBranch); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.CreateLocalReleaseTag(relTag, relBranch); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.PushTagToRemote(mgr.remoteName, relTag); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.CheckoutMainBranch(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *Manager) UnRelease(target misc.LaModule, doIt bool) error {
|
||||
fmt.Printf(
|
||||
"Unreleasing %s/%s\n",
|
||||
target.ShortName(), target.VersionRemote())
|
||||
|
||||
_, tag := determineBranchAndTag(target, target.VersionRemote())
|
||||
|
||||
gr := git.NewLoud(mgr.AbsPath(), doIt)
|
||||
|
||||
if err := gr.DeleteTagFromRemote(mgr.remoteName, tag); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gr.DeleteLocalTag(tag); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
35
cmd/gorepomod/internal/repo/managerfactory.go
Normal file
35
cmd/gorepomod/internal/repo/managerfactory.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/mod"
|
||||
)
|
||||
|
||||
// ManagerFactory is a collection of clean data needed to build
|
||||
// clean, fully wired up instances of Manager.
|
||||
type ManagerFactory struct {
|
||||
dg *DotGitData
|
||||
modules []*protoModule
|
||||
remoteName misc.TrackedRepo
|
||||
versionMapLocal misc.VersionMap
|
||||
versionMapRemote misc.VersionMap
|
||||
}
|
||||
|
||||
func (mf *ManagerFactory) NewRepoManager() *Manager {
|
||||
result := &Manager{
|
||||
dg: mf.dg,
|
||||
remoteName: mf.remoteName,
|
||||
}
|
||||
var modules misc.LesModules
|
||||
for _, pm := range mf.modules {
|
||||
shortName := pm.ShortName(mf.dg.RepoPath())
|
||||
modules = append(
|
||||
modules,
|
||||
mod.New(
|
||||
result, shortName, pm.mf,
|
||||
mf.versionMapLocal.Latest(shortName),
|
||||
mf.versionMapRemote.Latest(shortName)))
|
||||
}
|
||||
result.modules = modules
|
||||
return result
|
||||
}
|
||||
101
cmd/gorepomod/internal/repo/protomodule.go
Normal file
101
cmd/gorepomod/internal/repo/protomodule.go
Normal file
@@ -0,0 +1,101 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"golang.org/x/mod/modfile"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
dotDir = "."
|
||||
)
|
||||
|
||||
// protoModule holds parts being collected to represent a module.
|
||||
type protoModule struct {
|
||||
pathToGoMod string
|
||||
mf *modfile.File
|
||||
}
|
||||
|
||||
func (pm *protoModule) FullPath() string {
|
||||
return pm.mf.Module.Mod.Path
|
||||
}
|
||||
|
||||
func (pm *protoModule) PathToGoMod() string {
|
||||
return pm.pathToGoMod
|
||||
}
|
||||
|
||||
// Represents the trailing version label in a module name.
|
||||
// See https://blog.golang.org/v2-go-modules
|
||||
var trailingVersionPattern = regexp.MustCompile("/v\\d+$")
|
||||
|
||||
func (pm *protoModule) ShortName(
|
||||
repoImportPath string) misc.ModuleShortName {
|
||||
fp := pm.FullPath()
|
||||
if fp == repoImportPath {
|
||||
return misc.ModuleAtTop
|
||||
}
|
||||
p := fp[len(repoImportPath)+1:]
|
||||
stripped := trailingVersionPattern.ReplaceAllString(p, "")
|
||||
return misc.ModuleShortName(stripped)
|
||||
}
|
||||
|
||||
func loadProtoModules(
|
||||
repoRoot string, exclusions []string) (result []*protoModule, err error) {
|
||||
var paths []string
|
||||
paths, err = getPathsToModules(repoRoot, exclusions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, p := range paths {
|
||||
var pm *protoModule
|
||||
pm, err = loadProtoModule(p)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
result = append(result, pm)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func loadProtoModule(path string) (*protoModule, error) {
|
||||
mPath := filepath.Join(path, goModFile)
|
||||
content, err := ioutil.ReadFile(mPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading %q: %v\n", mPath, err)
|
||||
}
|
||||
f, err := modfile.Parse(mPath, content, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &protoModule{pathToGoMod: path, mf: f}, nil
|
||||
}
|
||||
|
||||
func getPathsToModules(
|
||||
repoRoot string, exclusions []string) (result []string, err error) {
|
||||
exclusionMap := utils.SliceToSet(exclusions)
|
||||
err = filepath.Walk(
|
||||
repoRoot,
|
||||
func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("trouble at pathToGoMod %q: %v\n", path, err)
|
||||
}
|
||||
if info.IsDir() {
|
||||
if _, ok := exclusionMap[info.Name()]; ok {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if info.Name() == goModFile {
|
||||
result = append(result, path[:len(path)-len(goModFile)-1])
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
47
cmd/gorepomod/internal/repo/protomodule_test.go
Normal file
47
cmd/gorepomod/internal/repo/protomodule_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"golang.org/x/mod/modfile"
|
||||
"golang.org/x/mod/module"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
)
|
||||
|
||||
func TestShortName(t *testing.T) {
|
||||
var testCases = map[string]struct {
|
||||
name misc.ModuleShortName
|
||||
modFile *modfile.File
|
||||
}{
|
||||
"one": {
|
||||
name: misc.ModuleShortName("garage"),
|
||||
modFile: &modfile.File{
|
||||
Module: &modfile.Module{
|
||||
Mod: module.Version{
|
||||
Path: "gh.com/micheal/garage",
|
||||
Version: "v2.3.4",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"three": {
|
||||
name: misc.ModuleShortName("fruit/yellow/banana"),
|
||||
modFile: &modfile.File{
|
||||
Module: &modfile.Module{
|
||||
Mod: module.Version{
|
||||
Path: "gh.com/micheal/fruit/yellow/banana",
|
||||
Version: "v2.3.4",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
m := protoModule{pathToGoMod: "irrelevant", mf: tc.modFile}
|
||||
actual := m.ShortName("gh.com/micheal")
|
||||
if actual != tc.name {
|
||||
t.Errorf(
|
||||
"%s: expected %s, got %s", n, tc.name, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
98
cmd/gorepomod/internal/semver/semver.go
Normal file
98
cmd/gorepomod/internal/semver/semver.go
Normal file
@@ -0,0 +1,98 @@
|
||||
package semver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SemVer is the immutable semantic version per https://semver.org
|
||||
type SemVer struct {
|
||||
major int
|
||||
minor int
|
||||
patch int
|
||||
}
|
||||
|
||||
func New(major, minor, patch int) SemVer {
|
||||
return SemVer{
|
||||
major: major,
|
||||
minor: minor,
|
||||
patch: patch,
|
||||
}
|
||||
}
|
||||
|
||||
var zero = New(0, 0, 0)
|
||||
|
||||
func Zero() SemVer {
|
||||
return zero
|
||||
}
|
||||
|
||||
// Versions implements sort.Interface to get decreasing order.
|
||||
type Versions []SemVer
|
||||
|
||||
func (v Versions) Len() int { return len(v) }
|
||||
func (v Versions) Less(i, j int) bool { return v[j].LessThan(v[i]) }
|
||||
func (v Versions) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
|
||||
|
||||
func Parse(raw string) (SemVer, error) {
|
||||
if len(raw) < 6 {
|
||||
// e.g. minimal length is 6, e.g. "v1.2.3"
|
||||
return zero, fmt.Errorf("%q too short to be a version", raw)
|
||||
}
|
||||
if raw[0] != 'v' {
|
||||
return zero, fmt.Errorf("%q must start with letter 'v'", raw)
|
||||
}
|
||||
fields := strings.Split(raw[1:], ".")
|
||||
if len(fields) < 3 {
|
||||
return zero, fmt.Errorf("%q doesn't have the form v1.2.3", raw)
|
||||
}
|
||||
n := make([]int, 3)
|
||||
for i := 0; i < 3; i++ {
|
||||
var err error
|
||||
n[i], err = strconv.Atoi(fields[i])
|
||||
if err != nil {
|
||||
return zero, err
|
||||
}
|
||||
}
|
||||
return New(n[0], n[1], n[2]), nil
|
||||
}
|
||||
|
||||
func (v SemVer) Bump(b SvBump) SemVer {
|
||||
switch b {
|
||||
case Major:
|
||||
return New(v.major+1, 0, 0)
|
||||
case Minor:
|
||||
return New(v.major, v.minor+1, 0)
|
||||
default:
|
||||
return New(v.major, v.minor, v.patch+1)
|
||||
}
|
||||
}
|
||||
|
||||
func (v SemVer) BranchLabel() string {
|
||||
return fmt.Sprintf("v%d.%d", v.major, v.minor)
|
||||
}
|
||||
|
||||
func (v SemVer) String() string {
|
||||
return fmt.Sprintf("v%d.%d.%d", v.major, v.minor, v.patch)
|
||||
}
|
||||
|
||||
func (v SemVer) Pretty() string {
|
||||
if v.IsZero() {
|
||||
return ""
|
||||
}
|
||||
return v.String()
|
||||
}
|
||||
|
||||
func (v SemVer) Equals(o SemVer) bool {
|
||||
return v.major == o.major && v.minor == o.minor && v.patch == o.patch
|
||||
}
|
||||
|
||||
func (v SemVer) LessThan(o SemVer) bool {
|
||||
return v.major < o.major ||
|
||||
(v.major == o.major && v.minor < o.minor) ||
|
||||
(v.major == o.major && v.minor == o.minor && v.patch < o.patch)
|
||||
}
|
||||
|
||||
func (v SemVer) IsZero() bool {
|
||||
return v.Equals(zero)
|
||||
}
|
||||
105
cmd/gorepomod/internal/semver/semver_test.go
Normal file
105
cmd/gorepomod/internal/semver/semver_test.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package semver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
var testCases = map[string]struct {
|
||||
raw string
|
||||
v SemVer
|
||||
errMsg string
|
||||
}{
|
||||
"one": {
|
||||
raw: "v1.2.3",
|
||||
v: SemVer{major: 1, minor: 2, patch: 3},
|
||||
errMsg: "",
|
||||
},
|
||||
"two": {
|
||||
raw: "v2.0.9999",
|
||||
v: SemVer{major: 2, minor: 0, patch: 9999},
|
||||
errMsg: "",
|
||||
},
|
||||
"three": {
|
||||
raw: "pizza",
|
||||
v: zero,
|
||||
errMsg: "\"pizza\" too short to be a version",
|
||||
},
|
||||
"non-digit": {
|
||||
raw: "v1.x.222",
|
||||
v: zero,
|
||||
errMsg: "strconv.Atoi: parsing \"x\": invalid syntax",
|
||||
},
|
||||
"bad fields": {
|
||||
raw: "v1.222",
|
||||
v: zero,
|
||||
errMsg: "\"v1.222\" doesn't have the form v1.2.3",
|
||||
},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
v, err := Parse(tc.raw)
|
||||
if err == nil {
|
||||
if tc.errMsg != "" {
|
||||
t.Errorf(
|
||||
"%s: no error, but expected err %q", n, tc.errMsg)
|
||||
}
|
||||
if !v.Equals(tc.v) {
|
||||
t.Errorf(
|
||||
"%s: expected %v, got %v", n, tc.v, v)
|
||||
}
|
||||
} else {
|
||||
if tc.errMsg == "" {
|
||||
t.Errorf(
|
||||
"%s: unexpected error %v", n, err)
|
||||
} else {
|
||||
if tc.errMsg != err.Error() {
|
||||
t.Errorf(
|
||||
"%s: expected err msg %q, but got %q",
|
||||
n, tc.errMsg, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLessThan(t *testing.T) {
|
||||
var testCases = map[string]struct {
|
||||
v1 SemVer
|
||||
v2 SemVer
|
||||
expected bool
|
||||
}{
|
||||
"one": {
|
||||
v1: SemVer{major: 2, minor: 2, patch: 3},
|
||||
v2: SemVer{major: 1, minor: 2, patch: 3},
|
||||
expected: false,
|
||||
},
|
||||
"two": {
|
||||
v1: SemVer{major: 1, minor: 3, patch: 3},
|
||||
v2: SemVer{major: 1, minor: 2, patch: 3},
|
||||
expected: false,
|
||||
},
|
||||
"three": {
|
||||
v1: SemVer{major: 1, minor: 2, patch: 4},
|
||||
v2: SemVer{major: 1, minor: 2, patch: 3},
|
||||
expected: false,
|
||||
},
|
||||
"eq": {
|
||||
v1: SemVer{major: 2, minor: 2, patch: 3},
|
||||
v2: SemVer{major: 2, minor: 2, patch: 3},
|
||||
expected: false,
|
||||
},
|
||||
"four": {
|
||||
v1: zero,
|
||||
v2: SemVer{major: 0, minor: 0, patch: 1},
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
actual := tc.v1.LessThan(tc.v2)
|
||||
if actual != tc.expected {
|
||||
t.Errorf(
|
||||
"%s: expected %v, got %v for %s LessThan %s",
|
||||
n, tc.expected, actual, tc.v1.String(), tc.v2.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
17
cmd/gorepomod/internal/semver/svbump.go
Normal file
17
cmd/gorepomod/internal/semver/svbump.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package semver
|
||||
|
||||
type SvBump int
|
||||
|
||||
const (
|
||||
Patch SvBump = iota
|
||||
Minor
|
||||
Major
|
||||
)
|
||||
|
||||
func (b SvBump) String() string {
|
||||
return map[SvBump]string{
|
||||
Patch: "Patch",
|
||||
Minor: "Minor",
|
||||
Major: "Major",
|
||||
}[b]
|
||||
}
|
||||
26
cmd/gorepomod/internal/utils/utils.go
Normal file
26
cmd/gorepomod/internal/utils/utils.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func DirExists(name string) bool {
|
||||
info, err := os.Stat(name)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
func SliceToSet(slice []string) map[string]bool {
|
||||
result := make(map[string]bool)
|
||||
for _, x := range slice {
|
||||
if _, ok := result[x]; ok {
|
||||
log.Fatalf("programmer error - repeated value: %s", x)
|
||||
} else {
|
||||
result[x] = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
84
cmd/gorepomod/main.go
Normal file
84
cmd/gorepomod/main.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/arguments"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/repo"
|
||||
)
|
||||
|
||||
//go:generate go run internal/gen/main.go
|
||||
|
||||
func loadRepoManager(args *arguments.Args) (*repo.Manager, error) {
|
||||
path, err := os.Getwd()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dg, err := repo.NewDotGitDataFromPath(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pr, err := dg.NewRepoFactory(args.Exclusions())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pr.NewRepoManager(), nil
|
||||
}
|
||||
|
||||
func actualMain() error {
|
||||
args, err := arguments.Parse()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mgr, err := loadRepoManager(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var targetModule misc.LaModule = nil
|
||||
if args.ModuleName() != misc.ModuleUnknown {
|
||||
targetModule = mgr.FindModule(args.ModuleName())
|
||||
if targetModule == nil {
|
||||
return fmt.Errorf(
|
||||
"cannot find module %q in repo %s",
|
||||
args.ModuleName(), mgr.RepoPath())
|
||||
}
|
||||
}
|
||||
|
||||
switch args.GetCommand() {
|
||||
case arguments.List:
|
||||
return mgr.List()
|
||||
case arguments.Tidy:
|
||||
return mgr.Tidy(args.DoIt())
|
||||
case arguments.Pin:
|
||||
v := args.Version()
|
||||
if v.IsZero() {
|
||||
v = targetModule.VersionLocal()
|
||||
}
|
||||
return mgr.Pin(args.DoIt(), targetModule, v)
|
||||
case arguments.UnPin:
|
||||
return mgr.UnPin(args.DoIt(), targetModule)
|
||||
case arguments.Release:
|
||||
return mgr.Release(targetModule, args.Bump(), args.DoIt())
|
||||
case arguments.UnRelease:
|
||||
return mgr.UnRelease(targetModule, args.DoIt())
|
||||
case arguments.Debug:
|
||||
return mgr.Debug(targetModule, args.DoIt())
|
||||
default:
|
||||
return fmt.Errorf("cannot handle cmd %v", args.GetCommand())
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Print(usageMsg)
|
||||
return
|
||||
}
|
||||
if err := actualMain(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
109
cmd/gorepomod/usage.go
Normal file
109
cmd/gorepomod/usage.go
Normal file
@@ -0,0 +1,109 @@
|
||||
// Code generated by internal/gen/main.go; DO NOT EDIT.
|
||||
package main
|
||||
|
||||
|
||||
const (
|
||||
usageMsg = `
|
||||
Helps when you have a git repository with multiple Go modules.
|
||||
|
||||
It handles tasks one might otherwise attempt with
|
||||
|
||||
'''
|
||||
find ./ -name "go.mod" | xargs {some hack}
|
||||
'''
|
||||
|
||||
Run it from a git repository root.
|
||||
|
||||
It walks the repository, reads 'go.mod' files, builds
|
||||
a model of Go modules and intra-repo module
|
||||
dependencies, then performs some operation.
|
||||
|
||||
Install:
|
||||
'''
|
||||
go get github.com/monopole/gorepomod
|
||||
'''
|
||||
|
||||
## Usage
|
||||
|
||||
_Commands that change things (everything but 'list')
|
||||
do nothing but log commands
|
||||
unless you add the '--doIt' flag,
|
||||
allowing the change._
|
||||
|
||||
#### 'gorepomod list'
|
||||
|
||||
Lists modules and intra-repo dependencies.
|
||||
|
||||
Use this to get module names for use in other commands.
|
||||
|
||||
#### 'gorepomod tidy'
|
||||
|
||||
Creates a change with mechanical updates
|
||||
to 'go.mod' and 'go.sum' files.
|
||||
|
||||
#### 'gorepomod unpin {module}'
|
||||
|
||||
Creates a change to 'go.mod' files.
|
||||
|
||||
For each module _m_ in the repository,
|
||||
if _m_ depends on a _{module}_,
|
||||
then _m_'s dependency on it will be replaced by
|
||||
a relative path to the in-repo module.
|
||||
|
||||
#### 'gorepomod pin {module} [{version}]'
|
||||
|
||||
Creates a change to 'go.mod' files.
|
||||
|
||||
The opposite of 'unpin'.
|
||||
|
||||
The change removes replacements and pins _m_ to a
|
||||
specific, previously tagged and released version of _{module}_.
|
||||
|
||||
The argument _{version}_ defaults to recent version of _{module}_.
|
||||
|
||||
_{version}_ should be in semver form, e.g. 'v1.2.3'.
|
||||
|
||||
|
||||
#### 'gorepomod release {module} [patch|minor|major]'
|
||||
|
||||
Computes a new version for the module, tags the repo
|
||||
with that version, and pushes the tag to the remote.
|
||||
|
||||
The value of the 2nd argument, either 'patch' (the default),
|
||||
'minor' or 'major', determines the new version.
|
||||
|
||||
If the existing version is _v1.2.7_, then the new version will be:
|
||||
- 'patch' -> _v1.2.8_
|
||||
- 'minor' -> _v1.3.0_
|
||||
- 'major' -> _v2.0.0_
|
||||
|
||||
After establishing the the version, the command looks for a branch named
|
||||
|
||||
> _release-{module}/-v{major}.{minor}_
|
||||
|
||||
If the branch doesn't exist, the command creates it and pushes it to the remote.
|
||||
|
||||
The command then creates a new tag in the form
|
||||
|
||||
> _{module}/v{major}.{minor}.{patch}_
|
||||
|
||||
The command pushes this tag to the remote. This typically triggers
|
||||
cloud activity to create release artifacts.
|
||||
|
||||
#### 'gorepomod unrelease {module}'
|
||||
|
||||
This undoes the work of 'release', by deleting the
|
||||
most recent tag both locally and at the remote.
|
||||
|
||||
You can then fix whatever, and re-release.
|
||||
|
||||
This, however, must be done almost immediately.
|
||||
|
||||
If there's a chance someone (or some cloud robot) already
|
||||
imported the module at the given tag, then don't do this,
|
||||
because it will confuse module caches.
|
||||
|
||||
Do a new patch release instead.
|
||||
|
||||
`
|
||||
)
|
||||
7
cmd/pluginator/go.mod
Normal file
7
cmd/pluginator/go.mod
Normal file
@@ -0,0 +1,7 @@
|
||||
module sigs.k8s.io/kustomize/pluginator/v2
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../api
|
||||
@@ -482,8 +482,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1 h1:5GRanVGU6+iq3ERTiQD9VIfyGByFVB4z4GthP8NkRYE=
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
8
cmd/prchecker/go.mod
Normal file
8
cmd/prchecker/go.mod
Normal file
@@ -0,0 +1,8 @@
|
||||
module sigs.k8s.io/kustomize/cmd/prchecker
|
||||
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/google/go-github v17.0.0+incompatible
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
)
|
||||
4
cmd/prchecker/go.sum
Normal file
4
cmd/prchecker/go.sum
Normal file
@@ -0,0 +1,4 @@
|
||||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
@@ -1,12 +1,16 @@
|
||||
// multi-module-span script:
|
||||
// A script which can detect when a pull request would make changes which
|
||||
// span a series of restricted directories (ex: multiple go modules or projects)
|
||||
// prchecker examines pull requests
|
||||
//
|
||||
// When a pull request includes files which span two modules the script will
|
||||
// exit with a non-zero exit code.
|
||||
// - When a PR includes files from multiple modules that we'd rather not
|
||||
// modify at the same time (in an effort to have more self-contained
|
||||
// release notes), the script will exit with a non-zero exit code.
|
||||
//
|
||||
// Running:
|
||||
// go run multi-module-span.go -owner=kubernetes-sigs -repo=kustomize -pr=2997 cmd/config api/ kustomize/ kyaml/
|
||||
// Usage:
|
||||
//
|
||||
// go run . \
|
||||
// -owner=kubernetes-sigs \
|
||||
// -repo=kustomize \
|
||||
// -pr=2997 \
|
||||
// cmd/config api kustomize kyaml
|
||||
|
||||
package main
|
||||
|
||||
@@ -57,15 +61,30 @@ func main() {
|
||||
// ListAllPullRequestFiles retrieves as many files as possible for the
|
||||
// target pull request.
|
||||
//
|
||||
// NOTE: GitHub API limits ListFiles to a maximum of 3000 files. Very large
|
||||
// Note: GitHub API limits ListFiles to a maximum of 3000 files. Very large
|
||||
// changes which exceed this limit may pass this check even if they
|
||||
// do contain spanning changes.
|
||||
// see: https://developer.github.com/v3/pulls/#list-pull-requests-files
|
||||
func ListAllPullRequestFiles(client *github.Client, owner *string, pullrequest *int, repo *string) ([]*github.CommitFile, error) {
|
||||
// foundFiles across all pages from github api
|
||||
var foundFiles []*github.CommitFile
|
||||
// GitHub returns the first 30 files by default, increase this value
|
||||
options := &github.ListOptions{PerPage: 3000}
|
||||
files, _, err := client.PullRequests.ListFiles(context.Background(), *owner, *repo, *pullrequest, options)
|
||||
return files, err
|
||||
// Note: Page 1 is the first page of results. Page 0 is an end of list mark.
|
||||
// Github only returns (max) 100 results per page and PR's may exceed this
|
||||
// so loop until all pages have been enumerated.
|
||||
options := &github.ListOptions{PerPage: 100, Page: 1}
|
||||
for options.Page != 0 {
|
||||
files, response, err := client.PullRequests.ListFiles(context.Background(), *owner, *repo, *pullrequest, options)
|
||||
|
||||
// If an error has occurred while querying api exit early, report error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
foundFiles = append(foundFiles, files...)
|
||||
// setup next page to continue loop
|
||||
options = &github.ListOptions{PerPage: 100, Page: response.NextPage}
|
||||
}
|
||||
return foundFiles, nil
|
||||
}
|
||||
|
||||
// CountModifiedRestrictedDirectories Accepts a map of paths and the number of
|
||||
76
hack/install_kpt.sh
Executable file
76
hack/install_kpt.sh
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If no arguments are given -> Downloads the most recently released
|
||||
# kpt binary to your current working directory.
|
||||
# (e.g. 'install_kpt.sh')
|
||||
#
|
||||
# If one argument is given -> Downloads the specified version of the
|
||||
# kpt binary to your current working directory.
|
||||
# (e.g. 'install_kpt.sh 0.34.0')
|
||||
#
|
||||
# If two arguments are given -> Downloads the specified version of the
|
||||
# kpt binary to the specified directory.
|
||||
# (e.g. 'install_kpt.sh 0.34.0 $(go env GOPATH)/bin')
|
||||
#
|
||||
# Fails if the file already exists.
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
version=""
|
||||
else
|
||||
version=$1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
where=$PWD
|
||||
else
|
||||
where=$2
|
||||
fi
|
||||
|
||||
if [ -f $where/kpt ]; then
|
||||
echo "A file named kpt already exists (remove it first)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmpDir=`mktemp -d`
|
||||
if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
|
||||
echo "Could not create temp dir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function cleanup {
|
||||
rm -rf "$tmpDir"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
pushd $tmpDir >& /dev/null
|
||||
|
||||
opsys=windows
|
||||
if [[ "$OSTYPE" == linux* ]]; then
|
||||
opsys=linux
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
opsys=darwin
|
||||
fi
|
||||
|
||||
curl -s https://api.github.com/repos/GoogleContainerTools/kpt/releases |\
|
||||
grep browser_download |\
|
||||
grep $opsys |\
|
||||
cut -d '"' -f 4 |\
|
||||
grep /kpt/releases/download/v$version |\
|
||||
sort | tail -n 1 |\
|
||||
xargs curl -s -O -L
|
||||
|
||||
if [ -e ./kpt_${opsys}_amd64-*.tar.gz ]; then
|
||||
tar xzf ./kpt_${opsys}_amd64-*.tar.gz
|
||||
else
|
||||
echo "Error: kpt binary with the version $version does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp ./kpt $where
|
||||
|
||||
popd >& /dev/null
|
||||
|
||||
$where/kpt version
|
||||
|
||||
echo kpt installed to specified directory.
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# In general, pin modules to a specific version of the
|
||||
# kustomize API before a release of that module, and
|
||||
# unpin the module after the module release so that
|
||||
# development proceeds against the API's HEAD.
|
||||
#
|
||||
# E.g. for the kustomize CLI module, do this before
|
||||
# releasing the CLI:
|
||||
#
|
||||
# ./hack/pinUnpin.sh pin kustomize v0.3.1
|
||||
#
|
||||
# where v0.3.1 is the most recently released version of
|
||||
# the API, and do the following afterwards:
|
||||
#
|
||||
# ./hack/pinUnpin.sh unPin kustomize
|
||||
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "usage:"
|
||||
echo " ./hack/pinUnpin.sh pin kustomize v0.3.1"
|
||||
echo " or "
|
||||
echo " ./hack/pinUnpin.sh unPin kustomize"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
operation=$1
|
||||
if [[ ("$operation" != "pin") && ("$operation" != "unPin") ]]; then
|
||||
echo "unknown operation $operation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
module=$2
|
||||
if [ ! -d "$module" ]; then
|
||||
echo "directory $module doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="unnecessary"
|
||||
if [ "$operation" == "pin" ]; then
|
||||
if [ "$#" -le 2 ]; then
|
||||
echo "Specify version to pin, e.g. '$0 $module pin v0.2.0'"
|
||||
exit 1
|
||||
fi
|
||||
version=$3
|
||||
fi
|
||||
|
||||
function unPin {
|
||||
oldV=$(grep -m 1 sigs.k8s.io/kustomize/api go.mod | awk '{print $NF}')
|
||||
go mod edit -replace=sigs.k8s.io/kustomize/api@${oldV}=../api
|
||||
go mod tidy
|
||||
}
|
||||
|
||||
function pin {
|
||||
oldV=$(grep -m 1 sigs.k8s.io/kustomize/api go.mod | awk '{print $NF}')
|
||||
go mod edit -dropreplace=sigs.k8s.io/kustomize/api@${oldV}
|
||||
go mod edit -require=sigs.k8s.io/kustomize/api@$version
|
||||
go mod tidy
|
||||
}
|
||||
|
||||
pushd $module >& /dev/null
|
||||
$operation
|
||||
popd >& /dev/null
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# To fix all plugin dependence to a particular
|
||||
# released version of the kustomize API,
|
||||
# run this from the repo root:
|
||||
#
|
||||
# ./hack/pinUnpinPluginApiDep.sh pin api v0.2.0
|
||||
#
|
||||
# To replace fixed dependence with
|
||||
# dependence on local filesystem (HEAD)
|
||||
# run this from the repo root:
|
||||
#
|
||||
# ./hack/pinUnpinPluginApiDep.sh unPin api
|
||||
#
|
||||
# All plugins, even plugins not written in Go,
|
||||
# have a unit test written in Go that depends
|
||||
# on a particular version of the api for a test
|
||||
# harness. The plugins written in Go, either
|
||||
# as exec or Go-plugin style plugins,
|
||||
# will likely depend directly on the kustomize
|
||||
# API, and any number of other 3rd party packages.
|
||||
#
|
||||
# The Go plugins in the `builtin` directory
|
||||
# are in practice converted to static libraries
|
||||
# in the API, so should remain unpinned (dependent
|
||||
# on HEAD). The other example plugins can be pinned
|
||||
# or unpinned on a case by case basis, since
|
||||
# they are just examples - but likely should
|
||||
# remain unpinned too. Nothing in the outside
|
||||
# world should depend on these plugin modules,
|
||||
# so there's no reason for them to be pinned.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
#set -o pipefail
|
||||
|
||||
function doUnPin {
|
||||
oldV=$(grep -m 1 sigs.k8s.io/kustomize/${module} go.mod | awk '{print $NF}')
|
||||
if [ ! -z $oldV ]; then
|
||||
go mod edit -replace=sigs.k8s.io/kustomize/${module}@${oldV}=$1
|
||||
fi
|
||||
go mod tidy
|
||||
}
|
||||
|
||||
function doPin {
|
||||
oldV=$(grep -m 1 sigs.k8s.io/kustomize/${module} go.mod | awk '{print $NF}')
|
||||
if [ ! -z $oldV ]; then
|
||||
go mod edit -dropreplace=sigs.k8s.io/kustomize/${module}@${oldV}
|
||||
go mod edit -require=sigs.k8s.io/kustomize/${module}@$1
|
||||
fi
|
||||
go mod tidy
|
||||
}
|
||||
|
||||
function forEachGoMod {
|
||||
for goMod in $(find $2 -name 'go.mod'); do
|
||||
d=$(dirname "${goMod}")
|
||||
echo "$1 $d"
|
||||
(cd $d; $1 $3)
|
||||
done
|
||||
}
|
||||
|
||||
function unPin {
|
||||
echo "Unpinning $module"
|
||||
forEachGoMod doUnPin ./plugin/builtin ../../../${module}
|
||||
forEachGoMod doUnPin ./plugin/someteam.example.com/v1 ../../../../${module}
|
||||
}
|
||||
|
||||
function pin {
|
||||
echo "Pinning $module to $version"
|
||||
forEachGoMod doPin ./plugin/builtin ${version}
|
||||
forEachGoMod doPin ./plugin/someteam.example.com/v1 ${version}
|
||||
}
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Pin or unpin plugins, e.g."
|
||||
echo " "
|
||||
echo " ./hack/pinUnpinPluginApiDep.sh pin api v0.2.0"
|
||||
echo " "
|
||||
echo " ./hack/pinUnpinPluginApiDep.sh unPin api"
|
||||
echo " "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
operation=$1
|
||||
if [[ ("$operation" != "pin") && ("$operation" != "unPin") ]]; then
|
||||
echo "unknown operation $operation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
module=$2
|
||||
if [[ ("$module" != "api") && ("$module" != "kyaml") ]]; then
|
||||
echo "unknown module $module"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="unnecessary"
|
||||
if [ "$operation" == "pin" ]; then
|
||||
if [ "$#" -le 2 ]; then
|
||||
echo "Specify version to pin, e.g. '$0 pin v0.2.0'"
|
||||
exit 1
|
||||
fi
|
||||
version=$3
|
||||
fi
|
||||
|
||||
$operation
|
||||
18
kustomize.Dockerfile
Normal file
18
kustomize.Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# build
|
||||
FROM golang:alpine as builder
|
||||
ARG VERSION
|
||||
ARG COMMIT
|
||||
ARG DATE
|
||||
RUN mkdir /build
|
||||
ADD . /build/
|
||||
WORKDIR /build/kustomize
|
||||
RUN CGO_ENABLED=0 GO111MODULE=on go build \
|
||||
-ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=${VERSION} \
|
||||
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=${COMMIT} \
|
||||
-X sigs.k8s.io/kustomize/api/provenance.buildDate=${DATE}"
|
||||
|
||||
# only copy binary
|
||||
FROM alpine
|
||||
COPY --from=builder /build/kustomize /app/
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["./kustomize"]
|
||||
@@ -3,13 +3,13 @@ module sigs.k8s.io/kustomize/kustomize/v3
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.3.0
|
||||
github.com/google/go-cmp v0.5.2
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
k8s.io/client-go v0.17.3
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/cmd/config v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/cmd/config v0.8.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
@@ -19,8 +19,6 @@ exclude (
|
||||
sigs.k8s.io/kustomize/cmd/config v0.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/cmd/config v0.8.1 => ../cmd/config
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../kyaml
|
||||
replace sigs.k8s.io/kustomize/cmd/config v0.8.2 => ../cmd/config
|
||||
|
||||
@@ -58,6 +58,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc
|
||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -203,6 +204,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@@ -269,6 +272,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
@@ -310,6 +315,8 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
|
||||
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
|
||||
@@ -392,6 +399,8 @@ github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb/go.mod h1:a8OnR
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
||||
@@ -440,6 +449,8 @@ golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8U
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M=
|
||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
@@ -467,6 +478,8 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
|
||||
@@ -494,6 +507,8 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c h1:Vco5b+cuG5NNfORVxZy6bYZQ7rsigisU1WQFkvQ0L5E=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -526,6 +541,10 @@ golang.org/x/tools v0.0.0-20190930201159-7c411dea38b0/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -541,6 +560,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
@@ -559,6 +580,8 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 h1:Xe2gvTZUJpsvOWUnvmL/tmhVBZUmHSvLbMjRj6NUUKo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
@@ -583,6 +606,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
.PHONY: generate license fix vet fmt test lint tidy openapi
|
||||
|
||||
MYGOBIN := $(shell go env GOPATH)/bin
|
||||
GOPATH := $(shell go env GOPATH)
|
||||
export PATH := $(MYGOBIN):$(PATH)
|
||||
|
||||
.PHONY: generate license fix vet fmt test lint tidy openapi schema
|
||||
all: generate license fix vet fmt test lint tidy
|
||||
|
||||
fix:
|
||||
@@ -34,11 +35,31 @@ test:
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
# sed command was added to resolve https://github.com/kubernetes-sigs/kustomize/issues/2767
|
||||
# it changes the ports merge key in kyaml/openapi/kubernetesapi/swagger.json
|
||||
# likely related to https://github.com/kubernetes/kubernetes/issues/39188
|
||||
openapi:
|
||||
sed -i 's/"x-kubernetes-patch-merge-key": "containerPort"/"x-kubernetes-patch-merge-key": "name"/g' 'openapi/kubernetesapi/swagger.json'
|
||||
(which $(GOPATH)/bin/go-bindata || go get -v github.com/go-bindata/go-bindata)
|
||||
(which $(GOPATH)/bin/go-bindata || go get -u github.com/go-bindata/go-bindata/...)
|
||||
$(GOPATH)/bin/go-bindata --pkg kubernetesapi -o openapi/kubernetesapi/swagger.go openapi/kubernetesapi/swagger.json
|
||||
$(GOPATH)/bin/go-bindata --pkg kustomizationapi -o openapi/kustomizationapi/swagger.go openapi/kustomizationapi/swagger.json
|
||||
|
||||
$(MYGOBIN)/kind:
|
||||
( \
|
||||
set -e; \
|
||||
d=$(shell mktemp -d); cd $$d; \
|
||||
wget -O ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(shell uname)-amd64; \
|
||||
chmod +x ./kind; \
|
||||
mv ./kind $(MYGOBIN); \
|
||||
rm -rf $$d; \
|
||||
)
|
||||
|
||||
$(MYGOBIN)/kpt:
|
||||
../hack/install_kpt.sh 0.34.0 $(MYGOBIN)
|
||||
|
||||
API_VERSION="v1.19.1"
|
||||
schema: $(MYGOBIN)/kind $(MYGOBIN)/kpt
|
||||
cp $(HOME)/.kube/config /tmp/kubeconfig.txt | true
|
||||
$(MYGOBIN)/kind create cluster --image kindest/node:$(API_VERSION) --name=getopenapidata
|
||||
$(MYGOBIN)/kpt live fetch-k8s-schema --pretty-print > /tmp/new_swagger.json
|
||||
$(MYGOBIN)/kind delete cluster --name=getopenapidata
|
||||
cp /tmp/kubeconfig.txt $(HOME)/.kube/config | true
|
||||
cp /tmp/new_swagger.json openapi/kubernetesapi/swagger.json
|
||||
|
||||
|
||||
|
||||
36
kyaml/openapi/README.md
Normal file
36
kyaml/openapi/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Sampling New OpenAPI Data
|
||||
|
||||
[kyaml]: ../
|
||||
[OpenAPI schema]: ./kubernetesapi/swagger.json
|
||||
[home]: ../../
|
||||
|
||||
This document describes how to fetch OpenAPI data from
|
||||
a particular kubernetes version number.
|
||||
|
||||
### Fetching the Schema
|
||||
In the [kyaml] directory, fetch the schema
|
||||
```
|
||||
make schema
|
||||
```
|
||||
|
||||
You can specify a specific version with the "API_VERSION"
|
||||
parameter. The default version is v1.19.1. Here is an
|
||||
example for fetching the data for v1.14.1.
|
||||
```
|
||||
make schema API_VERSION=v1.14.1
|
||||
```
|
||||
|
||||
This will update the [OpenAPI schema].
|
||||
|
||||
### Generating Swagger.go
|
||||
In the [kyaml] directory, generate the swagger.go files.
|
||||
```
|
||||
make openapi
|
||||
```
|
||||
|
||||
### Run all tests
|
||||
In the [home] directory, run the tests.
|
||||
```
|
||||
make prow-presubmit-check >& /tmp/k.txt; echo $?
|
||||
# The exit code should be zero; if not examine /tmp/k.txt
|
||||
```
|
||||
File diff suppressed because one or more lines are too long
@@ -5102,7 +5102,7 @@
|
||||
"protocol"
|
||||
],
|
||||
"x-kubernetes-list-type": "map",
|
||||
"x-kubernetes-patch-merge-key": "name",
|
||||
"x-kubernetes-patch-merge-key": "containerPort",
|
||||
"x-kubernetes-patch-strategy": "merge"
|
||||
},
|
||||
"readinessProbe": {
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/annotationstransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,10 +3,8 @@ module sigs.k8s.io/kustomize/plugin/builtin/configmapgenerator
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/builtin/hashtransformer
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/imagetagtransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/labeltransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -4,9 +4,7 @@ go 1.14
|
||||
|
||||
require (
|
||||
github.com/pkg/errors v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/namespacetransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -5,11 +5,9 @@ go 1.14
|
||||
require (
|
||||
github.com/evanphx/json-patch v4.5.0+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -4,11 +4,9 @@ go 1.14
|
||||
|
||||
require (
|
||||
github.com/pkg/errors v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -693,9 +693,8 @@ spec:
|
||||
}
|
||||
|
||||
// test for https://github.com/kubernetes-sigs/kustomize/issues/2767
|
||||
// resolved with a sed command in kyaml/Makefile that edits the file
|
||||
// kyaml/openapi/kubernetesapi/swagger.json to change the ports merge key
|
||||
// likely related to https://github.com/kubernetes/kubernetes/issues/39188
|
||||
// currently documents broken state. resulting ports: should have both
|
||||
// take-over-the-world and disappearing-act on 8080
|
||||
func TestPatchTransformerSimilarArrays(t *testing.T) {
|
||||
th := kusttest_test.MakeEnhancedHarness(t).
|
||||
PrepBuiltin("PatchTransformer")
|
||||
@@ -747,9 +746,6 @@ spec:
|
||||
- image: test-image
|
||||
name: test-deployment
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: take-over-the-world
|
||||
protocol: TCP
|
||||
- containerPort: 8080
|
||||
name: disappearing-act
|
||||
protocol: TCP
|
||||
|
||||
@@ -5,11 +5,9 @@ go 1.14
|
||||
require (
|
||||
github.com/evanphx/json-patch v4.5.0+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/prefixsuffixtransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/replicacounttransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,10 +3,8 @@ module sigs.k8s.io/kustomize/plugin/builtin/secretgenerator
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -523,6 +523,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,11 +3,9 @@ module sigs.k8s.io/kustomize/plugin/builtin/valueaddtransformer
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../kyaml
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../api
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/bashedconfigmap
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/chartinflator
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -4,10 +4,8 @@ go 1.14
|
||||
|
||||
require (
|
||||
github.com/pkg/errors v0.8.1
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/gogetter
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/printpluginenv
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,10 +3,8 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/replacementtransform
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -3,10 +3,8 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/secretsfromdatabase
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/api v0.6.2
|
||||
sigs.k8s.io/kustomize/api v0.6.3
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
@@ -525,6 +525,8 @@ k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@@ -2,8 +2,6 @@ module sigs.k8s.io/kustomize/plugin/someteam.example.com/v1/sedtransformer
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/api v0.6.2
|
||||
require sigs.k8s.io/kustomize/api v0.6.3
|
||||
|
||||
replace sigs.k8s.io/kustomize/api v0.6.2 => ../../../../api
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml v0.8.1 => ../../../../kyaml
|
||||
replace sigs.k8s.io/kustomize/api v0.6.3 => ../../../../api
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user