From 8018647c49817541c393af1a4238f00c9d0c5b65 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Oct 02 2020 19:10:03 +0000 Subject: doctranslation: move to openshift Signed-off-by: Francois Andrieu --- diff --git a/playbooks/openshift-apps/docstranslation.yml b/playbooks/openshift-apps/docstranslation.yml new file mode 100644 index 0000000..da64f06 --- /dev/null +++ b/playbooks/openshift-apps/docstranslation.yml @@ -0,0 +1,50 @@ +- name: make the app be real + hosts: os_masters[0]:os_masters_stg[0] + user: root + gather_facts: False + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + roles: + - role: openshift/project + app: docstranslation + description: Documentation translation + appowners: + - asamalik + - jibecfed + - misc + tags: + - apply-appowners + + - role: openshift/imagestream + app: docstranslation + imagename: builder + + - role: openshift/object + app: docstranslation + objectname: buildconfig.yml + file: buildconfig.yml + + - role: openshift/start-build + app: docstranslation + buildname: docstranslation-build + + - role: openshift/object + app: docstranslation + template: cron.yml + objectname: cron.yml + tags: + - deploy-cronjob + +############################################### +# actions to delete the project from OpenShift +############################################### +# to run: sudo rbac-playbook -l os_masters_stg[0] -t delete openshift-apps/docstranslation.yml + - role: openshift/object-delete + app: docstranslation + objecttype: cronjob + objectname: cron + tags: [ never, delete ] diff --git a/roles/openshift-apps/docstranslation/files/buildconfig.yml b/roles/openshift-apps/docstranslation/files/buildconfig.yml new file mode 100644 index 0000000..1d9bca3 --- /dev/null +++ b/roles/openshift-apps/docstranslation/files/buildconfig.yml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: BuildConfig +metadata: + labels: + build: docstranslation-build + name: docstranslation-build +spec: + successfulBuildsHistoryLimit: 2 + failedBuildsHistoryLimit: 1 + runPolicy: Serial + source: + git: + uri: "https://pagure.io/fedora-docs/translations-scripts.git" + ref: master + strategy: + type: Docker + output: + to: + kind: ImageStreamTag + name: builder:latest + diff --git a/roles/openshift-apps/docstranslation/files/cron.yml b/roles/openshift-apps/docstranslation/files/cron.yml new file mode 100644 index 0000000..b560439 --- /dev/null +++ b/roles/openshift-apps/docstranslation/files/cron.yml @@ -0,0 +1,37 @@ +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: cron +spec: + concurrencyPolicy: Forbid + schedule: "0 21 * * *" + jobTemplate: + spec: + template: + metadata: + labels: + parent: "cronjobtranslate" + spec: + containers: + - name: translate + image: docker-registry.default.svc:5000/docstranslation/builder:latest + command: + - /workspace/build.py + - "--clone_sources" + - "true" + - "--commit_l10n" + - "true" + - "--commit_tsources" + - "true" + - "--clone-po4a" + env: [] + volumeMounts: + - name: ssh-config-volume + mountPath: /workspace/.ssh + readOnly: true + restartPolicy: Never + startingDeadlineSeconds: 600 + volumes: + - name: ssh-config-volume + secret: + secretName: ssh-config diff --git a/roles/openshift-apps/docstranslation/templates/secrets.yml b/roles/openshift-apps/docstranslation/templates/secrets.yml new file mode 100644 index 0000000..4da3d60 --- /dev/null +++ b/roles/openshift-apps/docstranslation/templates/secrets.yml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: ssh-config + labels: + app: docstranslation +stringData: + id_rsa_docs_trans: |- + {{ lookup('file', {{private}} + '/files/id_rsa_docs_trans') }} + config: |- + Host pagure.io + User git + IdentityFile /workspace/.ssh/id_rsa_docs_trans + StrictHostKeyChecking no