Make translation pushes to gerrit branch aware

To support multiple translation versions in Zanata we need to make the
reverse push into Gerrit branch aware as well. Do this by setting up the
existing propose translation jobs to accept a branch parameter which
tells them which version to pull from Zanata and where to push into
Gerrit.

This will add a new periodic jenkins job for each release/branch.

Change-Id: Ia206bfaa7dd6eaad6aa1f6e5ddbbbf9cdadf8db0
This commit is contained in:
Clark Boylan 2015-09-21 10:16:58 -07:00
parent 1a06e58eae
commit 624832c5fa
3 changed files with 27 additions and 13 deletions

View File

@ -15,15 +15,15 @@
node: 'proposal'
- job-template:
name: '{name}-propose-translation-update'
name: '{name}-propose-translation-update{suffix}'
builders:
- revoke-sudo
- branch-git-prep:
branch: master
branch: '{branch}'
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/propose_translation_update.sh {name}
/usr/local/jenkins/slave_scripts/propose_translation_update.sh {name} {branch}
publishers:
- console-log
@ -33,15 +33,19 @@
- job-group:
name: translation-jobs
suffix: ''
branch: master
jobs:
- '{name}-upstream-translation-update'
- '{name}-propose-translation-update'
- '{name}-propose-translation-update{suffix}'
- job-group:
name: manual-translation-jobs
suffix: ''
branch: master
jobs:
- '{name}-upstream-translation-update'
- '{name}-propose-translation-update'
- '{name}-propose-translation-update{suffix}'
- 'gate-{name}-tox-{envlist}':
envlist: checklang
- '{name}-tox-doc-{envlist}':

View File

@ -132,6 +132,9 @@ function setup_manuals {
# Setup project so that git review works, sets global variable
# COMMIT_MSG.
function setup_review {
# Note we cannot rely on the default branch in .gitreview being
# correct so we are very explicit here.
local branch=${1:-master}
FULL_PROJECT=$(grep project .gitreview | cut -f2 -d= |sed -e 's/\.git$//')
set +e
read -d '' COMMIT_MSG <<EOF
@ -146,7 +149,7 @@ EOF
# See if there is an open change in the zanata/translations
# topic. If so, get the change id for the existing change for use
# in the commit msg.
change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set status:open project:$FULL_PROJECT topic:zanata/translations owner:proposal-bot)
change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set status:open project:$FULL_PROJECT branch:$branch topic:zanata/translations owner:proposal-bot)
previous=$(echo "$change_info" | grep "^ number:" | awk '{print $2}')
if [ -n "$previous" ]; then
change_id=$(echo "$change_info" | grep "^change" | awk '{print $2}')
@ -189,6 +192,7 @@ EOF
# Propose patch using COMMIT_MSG
function send_patch {
local branch=${1:-master}
# We don't have any repos storing zanata.xml, so just remove it.
rm -f zanata.xml
@ -199,7 +203,9 @@ function send_patch {
git commit -F- <<EOF
$COMMIT_MSG
EOF
git review -t zanata/translations
# We cannot rely on the default branch in .gitreview being
# correct so we are very explicit here.
git review -t zanata/translations $branch
fi
}

View File

@ -13,6 +13,10 @@
# under the License.
PROJECT=$1
BRANCH=$2
# Replace /'s in the branch name with -'s because Zanata does not
# allow /'s in version names.
ZANATA_VERSION=${BRANCH//\//-}
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
@ -155,25 +159,25 @@ function propose_django_openstack_auth {
setup_git
# Check whether a review already exists, setup review commit message.
setup_review
setup_review "$BRANCH"
case "$PROJECT" in
api-site|ha-guide|openstack-manuals|operations-guide|security-doc)
init_manuals "$PROJECT"
setup_manuals "$PROJECT"
setup_manuals "$PROJECT" "$ZANATA_VERSION"
propose_manuals
;;
django_openstack_auth)
setup_django_openstack_auth
setup_django_openstack_auth "$ZANATA_VERSION"
propose_django_openstack_auth
;;
horizon)
setup_horizon
setup_horizon "$ZANATA_VERSION"
propose_horizon
;;
*)
# Project specific setup.
setup_project "$PROJECT"
setup_project "$PROJECT" "$ZANATA_VERSION"
# Setup some global vars which will be used in the rest of the
# script.
setup_loglevel_vars
@ -185,4 +189,4 @@ esac
filter_commits
# Propose patch to gerrit if there are changes.
send_patch
send_patch "$BRANCH"