-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Moss
committed
Oct 14, 2020
1 parent
8c4c1ff
commit ec2c2bf
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
### | ||
|
||
set -o errexit | ||
set -o pipefail | ||
|
||
### | ||
# This script is to be used as a break-glass solution if there is a breaking | ||
# change in a release of Kubernetes. This allows us to switch to an unreleased | ||
# commit by submoduling the whole k/k repository. | ||
### | ||
|
||
VERSION=${1} | ||
if [ -z "$VERSION" ]; then | ||
echo "Usage: hack/submodule-k8s.sh <k8s sha>" | ||
exit 1 | ||
fi | ||
|
||
set -x | ||
|
||
MODS=($( | ||
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/${VERSION}/go.mod | | ||
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p' | ||
)) | ||
|
||
git submodule add --force https://github.com/kubernetes/kubernetes | ||
git submodule update --init --recursive --remote | ||
cd kubernetes | ||
git checkout $VERSION | ||
cd .. | ||
|
||
go mod edit "-replace=k8s.io/kubernetes=./kubernetes" | ||
|
||
for MOD in "${MODS[@]}"; do | ||
go mod edit "-replace=${MOD}=./kubernetes/staging/src/${MOD}" | ||
done | ||
go mod vendor | ||
go mod tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters