update-staging-godeps: only mangle staging repos in Godeps.json

This commit is contained in:
Dr. Stefan Schimanski
2017-09-18 17:49:48 +02:00
parent a514443091
commit 72d4e3f47a
4 changed files with 20 additions and 191 deletions

View File

@@ -500,7 +500,6 @@ plugin/pkg/scheduler/metrics
plugin/pkg/scheduler/schedulercache
plugin/pkg/scheduler/testing
plugin/pkg/scheduler/util
staging
staging/src/k8s.io/api/admission/v1alpha1
staging/src/k8s.io/api/admissionregistration/v1alpha1
staging/src/k8s.io/api/apps/v1beta1

View File

@@ -75,8 +75,26 @@ function updateGodepManifest() {
rm -rf Godeps # remove the current Godeps.json so we always rebuild it
GOPATH="${TMP_GOPATH}:${GOPATH}:${GOPATH}/src/k8s.io/kubernetes/staging" godep save ${GODEP_OPTS} ./... 2>&1 | sed 's/^/ /'
# Rewriting Godeps.json to remove commits that don't really exist because we haven't pushed the prereqs yet
go run "${KUBE_ROOT}/staging/godeps-json-updater.go" --godeps-file="${TMP_GOPATH}/src/k8s.io/${repo}/Godeps/Godeps.json" --override-import-path="k8s.io/${repo}"
# Rewriting Godeps.json to cross-out commits that don't really exist because we haven't pushed the prereqs yet
local repo
for repo in $(ls -1 ${KUBE_ROOT}/staging/src/k8s.io); do
# remove staging prefix
jq '.Deps |= map(.ImportPath |= ltrimstr("k8s.io/kubernetes/staging/src/"))' Godeps/Godeps.json |
# x-out staging repo revisions. They will only be known when the publisher bot has created the final export.
# We keep the staging dependencies in here though to give the publisher bot a way to detect when the staging
# dependencies changed. If they have changed, the bot will run a complete godep restore+save. If they didn't
# it will avoid that step, which takes quite some time.
jq '.Deps |= map((select(.ImportPath | (startswith("k8s.io/'${repo}'/") or . == "k8s.io/'${repo}'")) | .Rev |= "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") // .)' |
# remove comments
jq 'del(.Deps[].Comment)' |
# format with tabs
unexpand --first-only --tabs=2 > Godeps/Godeps.json.out
mv Godeps/Godeps.json.out Godeps/Godeps.json
done
# commit so that following repos do not see this repo as dirty
git add vendor >/dev/null