Enable custom k8s fork in update-vendor.sh
This commit is contained in:
parent
c2c5eaab3c
commit
23b4329759
|
|
@ -921,14 +921,15 @@ unexpected problems coming from version incompatibilities.
|
||||||
|
|
||||||
To sync the repositories' vendored k8s libraries, we have a script that takes a
|
To sync the repositories' vendored k8s libraries, we have a script that takes a
|
||||||
released version of k8s and updates the `replace` directives of each k8s
|
released version of k8s and updates the `replace` directives of each k8s
|
||||||
sub-library.
|
sub-library. It can be used with custom kubernetes fork, by default it uses
|
||||||
|
`git@github.com:kubernetes/kubernetes.git`.
|
||||||
|
|
||||||
Example execution looks like this:
|
Example execution looks like this:
|
||||||
```
|
```
|
||||||
./hack/update-vendor.sh 1.20.0-alpha.1
|
./hack/update-vendor.sh 1.20.0-alpha.1 git@github.com:kubernetes/kubernetes.git
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need to update vendor to an unreleased commit of Kubernetes, you can use the breakglass script:
|
If you need to update vendor to an unreleased commit of Kubernetes, you can use the breakglass script:
|
||||||
```
|
```
|
||||||
./hack/submodule-k8s.sh <k8s commit sha>
|
./hack/submodule-k8s.sh <k8s commit sha> git@github.com:kubernetes/kubernetes.git
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,29 @@ set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
VERSION=${1}
|
VERSION=${1}
|
||||||
|
FORK=${2:-git@github.com:kubernetes/kubernetes.git}
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "Usage: hack/submodule-k8s.sh <k8s sha>"
|
echo "Usage: hack/submodule-k8s.sh <k8s sha> <k8s fork:-git@github.com:kubernetes/kubernetes.git>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
WORKDIR=$(mktemp -d)
|
||||||
|
REPO="${WORKDIR}/kubernetes"
|
||||||
|
git clone --depth 1 ${FORK} ${REPO}
|
||||||
|
|
||||||
|
pushd ${REPO}
|
||||||
|
git fetch --depth 1 origin v${VERSION}
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
MODS=($(
|
MODS=($(
|
||||||
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/${VERSION}/go.mod |
|
cat go.mod | sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
|
||||||
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
|
|
||||||
))
|
))
|
||||||
|
|
||||||
|
popd
|
||||||
|
rm -rf ${WORKDIR}
|
||||||
|
|
||||||
git submodule add --force https://github.com/kubernetes/kubernetes
|
git submodule add --force https://github.com/kubernetes/kubernetes
|
||||||
git submodule update --init --recursive --remote
|
git submodule update --init --recursive --remote
|
||||||
cd kubernetes
|
cd kubernetes
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,29 @@ set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
VERSION=${1#"v"}
|
VERSION=${1#"v"}
|
||||||
|
FORK=${2:-git@github.com:kubernetes/kubernetes.git}
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "Usage: hack/update-vendor.sh <k8s version>"
|
echo "Usage: hack/update-vendor.sh <k8s version> <k8s fork:-git@github.com:kubernetes/kubernetes.git>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
WORKDIR=$(mktemp -d)
|
||||||
|
REPO="${WORKDIR}/kubernetes"
|
||||||
|
git clone --depth 1 ${FORK} ${REPO}
|
||||||
|
|
||||||
|
pushd ${REPO}
|
||||||
|
git fetch --depth 1 origin v${VERSION}
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
MODS=($(
|
MODS=($(
|
||||||
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
|
cat go.mod | sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
|
||||||
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
|
|
||||||
))
|
))
|
||||||
|
|
||||||
|
popd
|
||||||
|
rm -rf ${WORKDIR}
|
||||||
|
|
||||||
for MOD in "${MODS[@]}"; do
|
for MOD in "${MODS[@]}"; do
|
||||||
V=$(
|
V=$(
|
||||||
go mod download -json "${MOD}@kubernetes-${VERSION}" |
|
go mod download -json "${MOD}@kubernetes-${VERSION}" |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue