5c6d4fd636
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 21s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Successful in 1m16s
unit-tests Bats test report
CI Feature / Bats tests (push) Successful in 1m37s
CI Feature / Report Summary (push) Successful in 4s
59 lines
2.1 KiB
YAML
59 lines
2.1 KiB
YAML
{{- if .Values.initJob.enabled }}
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: {{ include "git-pages.fullname" . }}-init
|
|
labels:
|
|
{{- include "git-pages.componentLabels" . | nindent 4 }}
|
|
annotations:
|
|
"helm.sh/hook": post-install
|
|
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
|
spec:
|
|
backoffLimit: 5
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "git-pages.name" . }}-init
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
spec:
|
|
restartPolicy: Never
|
|
containers:
|
|
- name: init
|
|
image: "{{ .Values.initJob.image.repository }}:{{ .Values.initJob.image.tag }}"
|
|
imagePullPolicy: {{ .Values.initJob.image.pullPolicy }}
|
|
command:
|
|
- bash
|
|
- -c
|
|
- |
|
|
set -euo pipefail
|
|
apt-get update -qq && apt-get install -y -qq curl tar >/dev/null
|
|
echo "Init: waiting for git-pages..."
|
|
until curl -sf \
|
|
-H "Host: {{ .Values.ingress.host }}" \
|
|
-o /dev/null "http://git-pages:3000/.git-pages/health"
|
|
do sleep 2; done
|
|
echo "Init: checking if site already exists..."
|
|
MANIFEST=$(curl -sf \
|
|
-H "Host: {{ .Values.ingress.host }}" \
|
|
"http://git-pages:3000/.git-pages/manifest.json" 2>/dev/null || echo "")
|
|
|
|
if echo "$MANIFEST" | grep -q '"contents"'; then
|
|
echo "Init: site already initialized, skipping"
|
|
exit 0
|
|
fi
|
|
|
|
echo "Init: creating placeholder site..."
|
|
WORK=$(mktemp -d)
|
|
mkdir -p "$WORK/__init__"
|
|
echo "initialized" > "$WORK/__init__/index.html"
|
|
tar cf /tmp/init.tar -C "$WORK" __init__
|
|
curl -sf -X PUT "http://git-pages:3000/" \
|
|
-H "Host: {{ .Values.ingress.host }}" \
|
|
-H "Content-Type: application/x-tar" \
|
|
--data-binary @/tmp/init.tar -o /dev/null
|
|
echo "Init: done"
|
|
env:
|
|
- name: PAGES_INSECURE
|
|
value: "1"
|
|
{{- end }}
|