jenkins-bot has submitted this change and it was merged. Change subject: gerrit-sync-ve: split update and pushing ......................................................................
gerrit-sync-ve: split update and pushing The update of the VE repository is done by 'jenkins-slave' user but the push to Gerrit and approval has to be made by 'jenkins' user which has the SSH credentials for the Gerrit 'jenkins-bot' user. gerrit-sync-ve-push.sh basically push and approve --submit. Change-Id: I899986910bf207c034107c7992aaa5fad4336a39 --- A bin/gerrit-sync-ve-push.sh M bin/gerrit-sync-ve.sh 2 files changed, 25 insertions(+), 8 deletions(-) Approvals: Hashar: Looks good to me, approved jenkins-bot: Verified diff --git a/bin/gerrit-sync-ve-push.sh b/bin/gerrit-sync-ve-push.sh new file mode 100755 index 0000000..a2f3a0f --- /dev/null +++ b/bin/gerrit-sync-ve-push.sh @@ -0,0 +1,21 @@ +#!/bin/bash -xe +# +# Script to push VisualEditor updates to mediawiki/extensions.git + +MWEXT_DIR='src/extensions' +GERRIT_USER='jenkins-bot' +MWEXT_REPO_SSH="ssh://${GERRIT_USER}@gerrit.wikimedia.org:29418/mediawiki/extensions.git" + +if [[ "$USER" != "jenkins" ]]; then + echo "Must be run as 'jenkins' user to access $GERRIT_USER SSH credentials" + exit 1 +fi + +cd "${MWEXT_DIR}" +git show + +# Steps below needs the jenkins-bot credentials and should not write on disk +# since files in the workspace belong to jenkins-slave user. +git push "$MWEXT_REPO_SSH" HEAD:refs/for/master +MWEXT_HEAD=`git rev-parse HEAD` +ssh -p 29418 "${GERRIT_USER}"@gerrit.wikimedia.org "gerrit approve --code-review +2 --verified +2 --submit $MWEXT_HEAD" diff --git a/bin/gerrit-sync-ve.sh b/bin/gerrit-sync-ve.sh index a41a0e4..fbe3630 100755 --- a/bin/gerrit-sync-ve.sh +++ b/bin/gerrit-sync-ve.sh @@ -13,8 +13,6 @@ # which is exposed in the Jenkins job as the $ZUUL_COMMIT env variable. MWEXT_DIR='src/extensions' -GERRIT_USER='jenkins-bot' -MWEXT_REPO_SSH="ssh://${GERRIT_USER}@gerrit.wikimedia.org:29418/mediawiki/extensions.git" MWEXT_REPO_ANON="https://gerrit.wikimedia.org/r/p/mediawiki/extensions.git" if [[ -z "${ZUUL_COMMIT}" ]]; then @@ -22,8 +20,8 @@ exit 1 fi -if [[ "$USER" != "jenkins" ]]; then - echo "Must be run as 'jenkins' user to access jenkins-bot SSH credentials" +if [[ "$USER" != "jenkins-slave" ]]; then + echo "Must be run as 'jenkins-slave' just like any script" exit 1 fi @@ -66,9 +64,7 @@ # Install commit hook if needed if [ ! -e ".git/hooks/commit-msg" ]; then - scp -p -P 29418 "${GERRIT_USER}"@gerrit.wikimedia.org:hooks/commit-msg `git rev-parse --git-dir`/hooks/commit-msg + curl 'https://gerrit.wikimedia.org/r/tools/hooks/commit-msg' > `git rev-parse --git-dir`/hooks/commit-msg fi -git push "$MWEXT_REPO_SSH" HEAD:refs/for/master -MWEXT_HEAD=`git rev-parse HEAD` -ssh -p 29418 "${GERRIT_USER}"@gerrit.wikimedia.org "gerrit approve --code-review +2 --verified +2 --submit $MWEXT_HEAD" +echo "Done updating locally. Commit should now be pushed. Use gerrit-sync-ve-push.sh." -- To view, visit https://gerrit.wikimedia.org/r/107847 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I899986910bf207c034107c7992aaa5fad4336a39 Gerrit-PatchSet: 1 Gerrit-Project: integration/jenkins Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits