From 482f8959db0723e71891a1ef55fcc6c3cb8d3a92 Mon Sep 17 00:00:00 2001 From: Adriano Cunha <35786489+adrcunha@users.noreply.github.com> Date: Tue, 14 May 2019 14:30:32 -0700 Subject: [PATCH] Tool for updating test-infra in other repos (#772) --- hack/update-test-infra.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 hack/update-test-infra.sh diff --git a/hack/update-test-infra.sh b/hack/update-test-infra.sh new file mode 100755 index 0000000000..44f181a610 --- /dev/null +++ b/hack/update-test-infra.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Copyright 2019 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +echo +echo "This script updates the vendored test-infra in all Knative repos," +echo "creating commits for each one of them. The PRs must still be created" +echo "through GitHub UI (just open the link given at the end of the process)." +echo "This script expects the Knative repositories to be located under" +echo "\$GOPATH/src/github.com/knative (as instructed by the development docs)." + +cd ${GOPATH} +cd src/github.com/knative + +for repo in *; do + [[ "${repo}" == "test-infra" ]] && continue + cd ${repo} + echo -e "\n\n**** Updating test-infra in knative/${repo} ***\n\n" + branch="update-test-infra-$(basename $(mktemp))" + git checkout master + git remote update -p + git pull + git checkout -b ${branch} upstream/master + dep ensure -update github.com/knative/test-infra + ./hack/update-deps.sh + [[ -z "$(git diff)" ]] && continue + git commit -a -m "Update test-infra to the latest version" + git push -u origin ${branch} + echo -e "\nCheck the PR created above, and make changes if necessary" + echo -n "Hit [ENTER] to continue..." + read + cd .. +done