Add websites cronjob and build script
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
parent
d1cfb5d99a
commit
a770df5254
5 changed files with 61 additions and 0 deletions
|
@ -29,3 +29,13 @@
|
||||||
app: websites
|
app: websites
|
||||||
buildname: websites-build
|
buildname: websites-build
|
||||||
objectname: 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
|
||||||
|
|
4
roles/openshift-apps/websites/templates/build.sh
Normal file
4
roles/openshift-apps/websites/templates/build.sh
Normal 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
|
|
@ -9,6 +9,7 @@ spec:
|
||||||
dockerfile: |-
|
dockerfile: |-
|
||||||
FROM fedora:latest
|
FROM fedora:latest
|
||||||
RUN dnf -y install \
|
RUN dnf -y install \
|
||||||
|
git \
|
||||||
python-flask \
|
python-flask \
|
||||||
python-frozen-flask \
|
python-frozen-flask \
|
||||||
python-flask-assets \
|
python-flask-assets \
|
||||||
|
|
11
roles/openshift-apps/websites/templates/configmap.yml
Normal file
11
roles/openshift-apps/websites/templates/configmap.yml
Normal 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() }}
|
35
roles/openshift-apps/websites/templates/cron.yml
Normal file
35
roles/openshift-apps/websites/templates/cron.yml
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue