websites: add cronjob to update translation template

This commit is contained in:
Francois Andrieu 2021-10-16 16:47:20 +02:00 committed by kevin
parent 55be7c05f6
commit 1a24f15eb0
4 changed files with 98 additions and 1 deletions

View file

@ -2,7 +2,8 @@
hosts: os_masters_stg[0]:os_masters[0]
user: root
gather_facts: False
vars:
ssh_key_path: "{{ private }}/files/websites/id_rsa_web_trans_{{ env_short }}"
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
@ -40,7 +41,22 @@
template: configmap.yml
objectname: configmap.yml
- role: openshift/object
app: websites
template: gitconfig.yml
objectname: gitconfig.yml
- role: openshift/object
app: websites
template: sshconfig.yml
objectname: sshconfig.yml
- role: openshift/object
app: websites
template: cron.yml
objectname: cron.yml
- role: openshift/object
app: websites
template: cron-updatepot.yml
objectname: cron-updatepot.yml

View file

@ -0,0 +1,53 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: updatepot
spec:
concurrencyPolicy: Forbid
schedule: "0 20 * * *"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
activeDeadlineSeconds: 900
startingDeadlineSeconds: 300
jobTemplate:
spec:
backoffLimit: 0
template:
metadata:
labels:
parent: "updatepotcron"
spec:
containers:
- name: pushpot
image: docker-registry.default.svc:5000/websites/builder:latest
command: ["/bin/bash", "-c"]
args:
- |
cd /tmp
git clone https://pagure.io/fedora-web/websites.git
cd websites
for i in getfedora.org; do
pushd sites/$i/scripts
./translations-source.sh
[ -f $i.pot ] && ./push-pot.sh
popd
done
env: []
volumeMounts:
- mountPath: /.gitconfig
name: gitconfig
readOnly: true
subPath: .gitconfig
- name: sshconfig
mountPath: /.ssh
readOnly: true
restartPolicy: Never
startingDeadlineSeconds: 600
volumes:
- name: sshconfig
secret:
secretName: sshconfig
- name: gitconfig
configMap:
name: gitconfig

View file

@ -0,0 +1,13 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: gitconfig
labels:
app: websites
data:
.gitconfig: |-
[user]
name = ♪ I'm a bot, bot, bot ♪
email = _update_web_trans@sundries

View file

@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Secret
metadata:
name: sshconfig
labels:
app: websites
stringData:
id_rsa_web_trans: |-
{{ lookup('file', ssh_key_path) | indent(4) }}
config: |-
Host pagure.io
User git
IdentityFile /.ssh/id_rsa_web_trans
StrictHostKeyChecking no