Add websites cronjob and build script

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
Patrick Uiterwijk 2019-05-12 23:39:52 +02:00
parent d1cfb5d99a
commit a770df5254
5 changed files with 61 additions and 0 deletions

View file

@ -29,3 +29,13 @@
app: websites
buildname: websites-build
objectname: websites-build
- role: openshift/object
app: websites
template: configmap.yml
objectname: configmap.yml
- role: openshift/object
app: websites
template: cron.yml
objectname: cron.yml

View file

@ -0,0 +1,4 @@
#!/bin/bash -xe
git clone --branch {% if env == "staging" %}staging{% else %}master{% endif %} https://pagure.io/fedora-web/websites.git
cd websites
exec ./build.sh /output

View file

@ -9,6 +9,7 @@ spec:
dockerfile: |-
FROM fedora:latest
RUN dnf -y install \
git \
python-flask \
python-frozen-flask \
python-flask-assets \

View file

@ -0,0 +1,11 @@
{% macro load_file(filename) %}{% include filename %}{%- endmacro -%}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: websites-configmap
labels:
app: websites
data:
build.sh: |-
{{ load_file('build.sh') | indent() }}

View file

@ -0,0 +1,35 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: build
spec:
concurrencyPolicy: Forbid
schedule: "0 * * * *"
jobTemplate:
spec:
template:
metadata:
labels:
parent: "cronjobbuild"
spec:
containers:
- name: build
image: docker-registry.default.svc:5000/websites/builder:latest
env:
- name: BUILD_ENV
value: "{{ env_short }}"
volumeMounts:
- name: config
mountPath: /etc/websites
readOnly: true
- name: build-output
mountPath: /output
readOnly: false
restartPolicy: Never
volumes:
- name: config-volume
configMap:
name: websites-configmap
- name: build-output
persistentVolumeClaim:
claimName: websites-storage