Merge pull request #33338 from rmmh/pr-multirepo

Automatic merge from submit-queue

Make upload-to-gcs.sh use a different prefix for tests in other repos.

For kubernetes/test-infra#476.

Also, put the repo in the build metadata so Gubernator can link to the
right thing for postsubmit jobs.

For PR #$NUM in a given repo, the logs will go to these places:

	kubernetes/kubernetes => /pr-logs/pull/$NUM
	kubernetes/test-infra => /pr-logs/pull/test-infra/$NUM
	google/cadvisor => /pr-logs/pull/google_cadvisor/$NUM

Tested with a manual harness. Note that this leaves the latest/indirect
untouched as well as postsubmit jobs-- *job names* are still unique, the
main issue was that PR numbers might collide. Disturbing as little
structure as possible reduces how many things will break.
This commit is contained in:
Kubernetes Submit Queue 2016-09-26 18:42:25 -07:00 committed by GitHub
commit ddc884f8e4

View File

@ -46,8 +46,31 @@ if [[ ! ${JENKINS_UPLOAD_TO_GCS:-y} =~ ^[yY]$ ]]; then
exit 0
fi
# Attempt to determine if we're running against a repo other than
# kubernetes/kubernetes to determine whether to place PR logs in a different
# location.
#
# In the current CI system, the tracked repo is named remote. This is not true
# in general for most devs, where origin and upstream are more common.
GCS_SUBDIR=""
readonly remote_git_repo=$(git config --get remote.remote.url | sed 's:.*github.com/::' || true)
if [[ -n "${remote_git_repo}" ]]; then
case "${remote_git_repo}" in
# main repo: nothing extra
kubernetes/kubernetes) GCS_SUBDIR="" ;;
# a different repo on the k8s org: just the repo name (strip kubernetes/)
kubernetes/*) GCS_SUBDIR="${remote_git_repo#kubernetes/}/" ;;
# any other repo: ${org}_${repo} (replace / with _)
*) GCS_SUBDIR="${remote_git_repo/\//_}/" ;;
esac
if [[ "${remote_git_repo}" != "kubernetes/kubernetes" ]]; then
# also store the repo in started.json, so Gubernator can link it properly.
export BUILD_METADATA_REPO="${remote_git_repo}"
fi
fi
if [[ ${JOB_NAME} =~ -pull- ]]; then
: ${JENKINS_GCS_LOGS_PATH:="gs://kubernetes-jenkins/pr-logs/pull/${ghprbPullId:-unknown}"}
: ${JENKINS_GCS_LOGS_PATH:="gs://kubernetes-jenkins/pr-logs/pull/${GCS_SUBDIR}${ghprbPullId:-unknown}"}
: ${JENKINS_GCS_LATEST_PATH:="gs://kubernetes-jenkins/pr-logs/directory"}
: ${JENKINS_GCS_LOGS_INDIRECT:="gs://kubernetes-jenkins/pr-logs/directory/${JOB_NAME}"}
else