Rebase all into one commit. I should have used a branch
Trying out a readiness check Added init-container for dind Use a more graceful netcat command Slimmed some things down Added docker cli and use that for its readiness check fix: unittest Added parameter for deploying multiple runners Fix unittest job remove reference nc command remove reference in unittest again Trying to fix unittests Passing unit tests readme update readme making using pnpm
This commit is contained in:
@@ -15,6 +15,7 @@ If `.Values.image.rootless: true`, then the following will occur. In case you us
|
||||
| `enabled` | Create an act runner StatefulSet. | `false` |
|
||||
| `init.image.repository` | The image used for the init containers | `busybox` |
|
||||
| `init.image.tag` | The image tag used for the init containers | `1.37.0` |
|
||||
| `statefulset.replicas` | the amount of (replica) runners deployed | `1` |
|
||||
| `statefulset.annotations` | Act runner annotations | `{}` |
|
||||
| `statefulset.labels` | Act runner labels | `{}` |
|
||||
| `statefulset.resources` | Act runner resources | `{}` |
|
||||
|
||||
@@ -113,19 +113,3 @@ app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{/*
|
||||
Parse the http url to hostname + port separated by space for the nc command
|
||||
*/}}
|
||||
{{- define "gitea.actions.nc" -}}
|
||||
{{- $url := include "gitea.actions.local_root_url" . | urlParse -}}
|
||||
{{- $host := get $url "host" -}}
|
||||
{{- $scheme := get $url "scheme" -}}
|
||||
{{- $port := "80" -}}
|
||||
{{- if contains ":" $host -}}
|
||||
{{- $hostAndPort := regexSplit ":" $host 2 -}}
|
||||
{{- $host = index $hostAndPort 0 -}}
|
||||
{{- $port = index $hostAndPort 1 -}}
|
||||
{{- else if eq $scheme "https" -}}
|
||||
{{- $port = "443" -}}
|
||||
{{- else if eq $scheme "http" -}}
|
||||
{{- $port = "80" -}}
|
||||
{{- end -}}
|
||||
{{- printf "%s %s" $host $port -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -36,8 +36,9 @@ spec:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
while ! nc -z {{ include "gitea.actions.nc" . }}; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- {{ include "gitea.actions.local_root_url" . }} > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
containers:
|
||||
- name: actions-token-create
|
||||
|
||||
@@ -16,6 +16,7 @@ metadata:
|
||||
name: {{ include "gitea.actions.fullname" . }}-act-runner
|
||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||
spec:
|
||||
replicas: {{ .Values.statefulset.replicas | default 1 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "gitea.actions.selectorLabels.actRunner" . | nindent 6 }}
|
||||
@@ -36,14 +37,26 @@ spec:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
while ! nc -z {{ include "gitea.actions.nc" . }}; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- {{ include "gitea.actions.local_root_url" . }} > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
containers:
|
||||
- name: act-runner
|
||||
image: "{{ .Values.statefulset.actRunner.repository }}:{{ .Values.statefulset.actRunner.tag }}"
|
||||
imagePullPolicy: {{ .Values.statefulset.actRunner.pullPolicy }}
|
||||
workingDir: /data
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
apk add --no-cache docker-cli
|
||||
echo "Waiting for Docker daemon..."
|
||||
until docker info > /dev/null 2>&1; do
|
||||
sleep 2
|
||||
done
|
||||
echo "Docker is ready, starting act-runner..."
|
||||
exec run.sh
|
||||
env:
|
||||
- name: DOCKER_HOST
|
||||
value: tcp://127.0.0.1:2376
|
||||
|
||||
@@ -60,7 +60,7 @@ tests:
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: renders a Job with correct nc command
|
||||
- it: renders a Job with correct wget wait command
|
||||
template: templates/job.yaml
|
||||
set:
|
||||
enabled: true
|
||||
@@ -83,6 +83,7 @@ tests:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].command[2]
|
||||
value: |
|
||||
while ! nc -z git.example.com 8443; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- https://git.example.com:8443 > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
@@ -73,7 +73,7 @@ tests:
|
||||
- it: renders a StatefulSet http (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
||||
template: templates/statefulset.yaml
|
||||
set:
|
||||
giteaRootURL: "http://git.example.com"
|
||||
giteaRootURL: "https://git.example.com"
|
||||
enabled: true
|
||||
existingSecret: "my-secret"
|
||||
existingSecretKey: "my-secret-key"
|
||||
@@ -88,12 +88,13 @@ tests:
|
||||
path: spec.template.spec.containers[0].env[4]
|
||||
value:
|
||||
name: GITEA_INSTANCE_URL
|
||||
value: "http://git.example.com"
|
||||
value: "https://git.example.com"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].command[2]
|
||||
value: |
|
||||
while ! nc -z git.example.com 80; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- https://git.example.com > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
- it: renders a StatefulSet https (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
||||
template: templates/statefulset.yaml
|
||||
@@ -117,13 +118,14 @@ tests:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].command[2]
|
||||
value: |
|
||||
while ! nc -z git.example.com 443; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- https://git.example.com > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
- it: renders a StatefulSet https (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
||||
template: templates/statefulset.yaml
|
||||
set:
|
||||
giteaRootURL: "https://git.example.com:8443"
|
||||
giteaRootURL: "https://git.example.com"
|
||||
enabled: true
|
||||
existingSecret: "my-secret"
|
||||
existingSecretKey: "my-secret-key"
|
||||
@@ -138,12 +140,13 @@ tests:
|
||||
path: spec.template.spec.containers[0].env[4]
|
||||
value:
|
||||
name: GITEA_INSTANCE_URL
|
||||
value: "https://git.example.com:8443"
|
||||
value: "https://git.example.com"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].command[2]
|
||||
value: |
|
||||
while ! nc -z git.example.com 8443; do
|
||||
sleep 5
|
||||
echo 'Waiting for gitea...'
|
||||
while ! wget -qO- https://git.example.com > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
- it: allows adding custom environment variables to the docker-in-docker container
|
||||
template: templates/statefulset.yaml
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
## @param enabled Create an act runner StatefulSet.
|
||||
## @param init.image.repository The image used for the init containers
|
||||
## @param init.image.tag The image tag used for the init containers
|
||||
## @param statefulset.replicas the amount of (replica) runners deployed
|
||||
## @param statefulset.annotations Act runner annotations
|
||||
## @param statefulset.labels Act runner labels
|
||||
## @param statefulset.resources Act runner resources
|
||||
@@ -39,6 +40,7 @@
|
||||
## @param giteaRootURL URL the act_runner registers and connect with
|
||||
enabled: false
|
||||
statefulset:
|
||||
replicas: 1
|
||||
annotations: {}
|
||||
labels: {}
|
||||
resources: {}
|
||||
|
||||
Reference in New Issue
Block a user