Ansible job definitions for OpenStack projects CI systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

upstream_translation_update.sh 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash -xe
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. PROJECT=$1
  14. JOBNAME=$2
  15. BRANCHNAME=$3
  16. HORIZON_DIR=$4
  17. # Replace /'s in branch names with -'s because Zanata doesn't
  18. # allow /'s in version names.
  19. ZANATA_VERSION=${BRANCHNAME//\//-}
  20. SCRIPTSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  21. source $SCRIPTSDIR/common_translation_update.sh
  22. init_branch $BRANCHNAME
  23. # List of all modules to copy POT files from
  24. ALL_MODULES=""
  25. # Setup venv - needed for all projects for our tools
  26. setup_venv
  27. if ! python $SCRIPTSDIR/query-zanata-project-version.py \
  28. -p $PROJECT -v $ZANATA_VERSION; then
  29. # Exit successfully so that lack of a version doesn't cause the jenkins
  30. # jobs to fail. This is necessary because not all branches of a project
  31. # will be translated.
  32. # Tell finish function that everything is fine.
  33. ERROR_ABORT=0
  34. exit 0
  35. fi
  36. setup_git
  37. # Project setup and updating POT files.
  38. case "$PROJECT" in
  39. api-site|openstack-manuals|security-doc)
  40. init_manuals "$PROJECT"
  41. # POT file extraction is done in setup_manuals.
  42. setup_manuals "$PROJECT" "$ZANATA_VERSION"
  43. case "$PROJECT" in
  44. api-site)
  45. ALL_MODULES="api-quick-start firstapp"
  46. ;;
  47. security-doc)
  48. ALL_MODULES="security-guide"
  49. ;;
  50. *)
  51. ALL_MODULES="doc"
  52. ;;
  53. esac
  54. if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
  55. extract_messages_releasenotes
  56. ALL_MODULES="releasenotes $ALL_MODULES"
  57. fi
  58. ;;
  59. training-guides)
  60. setup_training_guides "$ZANATA_VERSION"
  61. ALL_MODULES="doc"
  62. ;;
  63. i18n)
  64. setup_i18n "$ZANATA_VERSION"
  65. ALL_MODULES="doc"
  66. ;;
  67. tripleo-ui)
  68. setup_reactjs_project "$PROJECT" "$ZANATA_VERSION"
  69. # The pot file is generated in the ./i18n directory
  70. ALL_MODULES="i18n"
  71. ;;
  72. *)
  73. # Common setup for python and django repositories
  74. setup_project "$PROJECT" "$ZANATA_VERSION"
  75. # ---- Python projects ----
  76. module_names=$(get_modulename $PROJECT python)
  77. if [ -n "$module_names" ]; then
  78. if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
  79. extract_messages_releasenotes
  80. ALL_MODULES="releasenotes $ALL_MODULES"
  81. fi
  82. for modulename in $module_names; do
  83. extract_messages_python "$modulename"
  84. ALL_MODULES="$modulename $ALL_MODULES"
  85. done
  86. fi
  87. # ---- Django projects ----
  88. module_names=$(get_modulename $PROJECT django)
  89. if [ -n "$module_names" ]; then
  90. install_horizon
  91. if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
  92. extract_messages_releasenotes
  93. ALL_MODULES="releasenotes $ALL_MODULES"
  94. fi
  95. for modulename in $module_names; do
  96. extract_messages_django "$modulename"
  97. ALL_MODULES="$modulename $ALL_MODULES"
  98. done
  99. fi
  100. # ---- Documentation ----
  101. if [[ -f doc/source/conf.py ]]; then
  102. # Let's test this with some repos :)
  103. if [[ ${DOC_TARGETS[*]} =~ "$PROJECT" ]]; then
  104. extract_messages_doc
  105. ALL_MODULES="doc $ALL_MODULES"
  106. fi
  107. fi
  108. ;;
  109. esac
  110. # The Zanata client works out what to send based on the zanata.xml file.
  111. # Do not copy translations from other files for this change.
  112. zanata-cli -B -e push --copy-trans False
  113. # Move pot files to translation-source directory for publishing
  114. copy_pot "$ALL_MODULES"
  115. mv .translation-source translation-source
  116. # Tell finish function that everything is fine.
  117. ERROR_ABORT=0