publish source translations to s3

refs FOO-2371
flag = none

test plan: jenkins does what the title says (on post-merge)

Change-Id: Id17a194c1c96ade4d21cea0a6ed97205a8eb2754
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275751
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
This commit is contained in:
Ahmad Amireh 2021-10-12 10:29:06 -06:00
parent d91263c442
commit 242dcd18ce
3 changed files with 43 additions and 1 deletions

4
Jenkinsfile vendored
View File

@ -479,6 +479,10 @@ pipeline {
extendedStage(LINTERS_BUILD_IMAGE_STAGE)
.queue(stages, buildDockerImageStage.&lintersImage)
extendedStage('Run i18n:generate')
.required(configuration.isChangeMerged())
.queue(stages, buildDockerImageStage.&i18nGenerate)
parallel(stages)
}
}

View File

@ -193,3 +193,41 @@ def patchsetImage() {
""", label: 'upload cache images')
}
}
def i18nGenerate() {
def dest = 's3://instructure-translations/sources/canvas-lms/en/en.yml'
def roleARN = 'arn:aws:iam::307761260553:role/translations-jenkins'
sh(
label: 'generate the source translations file (en.yml)',
script: """
docker run --name=transifreq \
-e RAILS_LOAD_ALL_LOCALES=1 \
-e COMPILE_ASSETS_CSS=0 \
-e COMPILE_ASSETS_STYLEGUIDE=0 \
-e COMPILE_ASSETS_BUILD_JS=0 \
$PATCHSET_TAG \
bundle exec rake canvas:compile_assets i18n:generate
"""
)
sh(
label: 'stage the source translations file for uploading to s3',
script: ' \
docker cp \
transifreq:/usr/src/app/config/locales/generated/en.yml \
transifreq-en.yml \
'
)
sh(
label: 'upload the source translations file to s3',
script: """
aws configure set profile.transifreq.credential_source Ec2InstanceMetadata &&
aws configure set profile.transifreq.role_arn $roleARN &&
aws s3 cp --profile transifreq --acl bucket-owner-full-control \
./transifreq-en.yml \
$dest
"""
)
}

View File

@ -53,7 +53,7 @@ unless $canvas_tasks_loaded
task 'i18n:generate_js' => [
('js:yarn_install' if npm_install)
].compact if build_i18n && build_js
].compact if build_i18n
task 'js:webpack_development' => [
'js:gulp_rev',