New job template for translation management.
Add a new job template for translation management. Add two jobs for translation management. The first will will update transifex with the new .pot and .po files after every merge to a project. The second will commit the new .pot and .po files and submit for review once a day. Add puppet manifest for the slave that these jobs will be running on. Apply the template to nova. Change-Id: I5242f81bd6ff13d1ed8610ef9e3b39fd3dbd7301 Reviewed-on: https://review.openstack.org/11369 Reviewed-by: James E. Blair <corvus@inaugust.com> Approved: Monty Taylor <mordred@inaugust.com> Reviewed-by: Monty Taylor <mordred@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
a27164e67b
commit
2e589d19cb
@ -141,6 +141,13 @@ node /^ci-backup-.*\.openstack\.org$/ {
|
||||
# Jenkins slaves:
|
||||
#
|
||||
|
||||
node 'tx.slave.openstack.org' {
|
||||
class { 'openstack_project::translation_slave':
|
||||
transifex_username => 'openstackjenkins',
|
||||
transifex_password => hiera('transifex_password')
|
||||
}
|
||||
}
|
||||
|
||||
# Rollout cgroups to precise slaves.
|
||||
node /^precise.*\.slave\.openstack\.org$/ {
|
||||
include openstack_project::puppet_cron
|
||||
|
37
modules/jenkins/files/slave_scripts/propose_translation_update.sh
Executable file
37
modules/jenkins/files/slave_scripts/propose_translation_update.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
PROJECT=$1
|
||||
|
||||
git config user.name "OpenStack Jenkins"
|
||||
git config user.email "jenkins@openstack.org"
|
||||
|
||||
# See if there is an open change in the transifex/translations topic
|
||||
# If so, amend the commit with new changes since then
|
||||
previous=`ssh -p 29418 review.openstack.org gerrit query --current-patch-set status:open project:openstack/$PROJECT topic:transifex/translations | grep "^ number:" | awk '{print $2}'`
|
||||
if [ "x${previous}" != "x" ] ; then
|
||||
git review -d ${previous}
|
||||
amend="--amend"
|
||||
fi
|
||||
|
||||
# initialize transifex client
|
||||
tx init
|
||||
tx set --auto-local -r ${PROJECT}.${PROJECT}-translations "${PROJECT}/locale/<lang>/LC_MESSAGES/${PROJECT}.po" --source-lang en --source-file ${PROJECT}/locale/${PROJECT}.pot --execute
|
||||
|
||||
# Pull all upstream translations
|
||||
tx pull -a
|
||||
# Update the .pot file
|
||||
python setup.py extract_messages
|
||||
# Use updated .pot file to update translations
|
||||
python setup.py update_catalog
|
||||
# Add all changed files to git
|
||||
git add $PROJECT/locale/*
|
||||
|
||||
if [ ! `git diff-index --quiet HEAD --` ]
|
||||
then
|
||||
# Commit and review
|
||||
git commit ${amend} -m "Imported Translations from Transifex"
|
||||
git review -t transifex/translations
|
||||
|
||||
# Push changes to transifex
|
||||
tx push -st
|
||||
fi
|
30
modules/jenkins/files/slave_scripts/upstream_translation_update.sh
Executable file
30
modules/jenkins/files/slave_scripts/upstream_translation_update.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
PROJECT=$1
|
||||
|
||||
if [ ! `echo $ZUUL_REFNAME | grep master` ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "OpenStack Jenkins"
|
||||
git config user.email "jenkins@openstack.org"
|
||||
|
||||
# initialize transifex client
|
||||
tx init
|
||||
tx set --auto-local -r ${PROJECT}.${PROJECT}-translations "${PROJECT}/locale/<lang>/LC_MESSAGES/${PROJECT}.po" --source-lang en --source-file ${PROJECT}/locale/${PROJECT}.pot --execute
|
||||
|
||||
# Pull all upstream translations
|
||||
tx pull -a
|
||||
# Update the .pot file
|
||||
python setup.py extract_messages
|
||||
# Use updated .pot file to update translations
|
||||
python setup.py update_catalog
|
||||
# Add all changed files to git
|
||||
git add $PROJECT/locale/*
|
||||
|
||||
if [ ! `git diff-index --quiet HEAD --` ]
|
||||
then
|
||||
# Push changes to transifex
|
||||
tx push -st
|
||||
fi
|
@ -199,6 +199,7 @@
|
||||
- python-essex-bitrot-jobs
|
||||
- openstack-publish-jobs
|
||||
- gate-{name}-pylint
|
||||
- translation-jobs
|
||||
|
||||
|
||||
- project:
|
||||
|
@ -0,0 +1,47 @@
|
||||
- job-template:
|
||||
name: '{name}-upstream-translation-update'
|
||||
concurrent: false
|
||||
|
||||
triggers:
|
||||
- zuul-post
|
||||
|
||||
builders:
|
||||
- gerrit-git-prep
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/upstream_translation_update.sh {name}
|
||||
|
||||
publishers:
|
||||
- console-log-post
|
||||
|
||||
node: 'tx'
|
||||
|
||||
- job-template:
|
||||
name: '{name}-propose-translation-update'
|
||||
concurrent: false
|
||||
|
||||
triggers:
|
||||
- timed: '@daily'
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/propose_translation_update.sh {name}
|
||||
|
||||
publishers:
|
||||
- console-log-periodic
|
||||
|
||||
scm:
|
||||
- git:
|
||||
url: 'git://github.com/{github-org}/{name}.git'
|
||||
branches:
|
||||
- 'origin/master'
|
||||
|
||||
node: 'tx'
|
||||
|
||||
|
||||
- job-group:
|
||||
name: translation-jobs
|
||||
jobs:
|
||||
- '{name}-upstream-translation-update'
|
||||
- '{name}-propose-translation-update'
|
@ -313,6 +313,7 @@ projects:
|
||||
- nova-tarball
|
||||
- nova-coverage
|
||||
- nova-docs
|
||||
- nova-upstream-translation-update
|
||||
publish:
|
||||
- nova-tarball
|
||||
- nova-docs
|
||||
|
23
modules/openstack_project/manifests/translation_slave.pp
Normal file
23
modules/openstack_project/manifests/translation_slave.pp
Normal file
@ -0,0 +1,23 @@
|
||||
class openstack_project::translation_slave (
|
||||
transifex_username = 'openstackci',
|
||||
transifex_password
|
||||
) {
|
||||
|
||||
include openstack_project::slave
|
||||
|
||||
package { ['transifex-client', 'Babel']:
|
||||
ensure => latest,
|
||||
provider => pip,
|
||||
require => Class[pip]
|
||||
}
|
||||
|
||||
file { '/home/jenkins/.transifexrc':
|
||||
owner => 'jenkins',
|
||||
group => 'jenkins',
|
||||
mode => 0600,
|
||||
ensure => 'present',
|
||||
content => template('openstack_project/transifexrc.erb'),
|
||||
require => User['jenkins'],
|
||||
}
|
||||
|
||||
}
|
5
modules/openstack_project/templates/transifexrc.erb
Normal file
5
modules/openstack_project/templates/transifexrc.erb
Normal file
@ -0,0 +1,5 @@
|
||||
[https://www.transifex.com]
|
||||
hostname = https://www.transifex.com
|
||||
password = <%= transifex_password %>
|
||||
token =
|
||||
username = <%= transifex_username %>
|
Loading…
Reference in New Issue
Block a user