diff --git a/bootstrap/gitea-actions/runner-configmap.yaml b/bootstrap/gitea-actions/runner-configmap.yaml index 1c6f264..77353d7 100644 --- a/bootstrap/gitea-actions/runner-configmap.yaml +++ b/bootstrap/gitea-actions/runner-configmap.yaml @@ -14,5 +14,5 @@ data: cache: enabled: false container: - docker_host: unix:///var/run/docker.sock + docker_host: tcp://127.0.0.1:2375 force_pull: true diff --git a/bootstrap/gitea-actions/runner-deployment.yaml b/bootstrap/gitea-actions/runner-deployment.yaml index 08501f8..cc424e0 100644 --- a/bootstrap/gitea-actions/runner-deployment.yaml +++ b/bootstrap/gitea-actions/runner-deployment.yaml @@ -33,6 +33,41 @@ spec: - name: dind-data emptyDir: sizeLimit: 20Gi + initContainers: + - name: register + image: docker.io/gitea/act_runner:latest + env: + - name: GITEA_INSTANCE_URL + value: https://gitea.mpabi.pl + - name: GITEA_RUNNER_NAME + value: trade-next-sol + - name: GITEA_RUNNER_LABELS + value: ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest,k3s-deploy:docker://docker.gitea.com/runner-images:ubuntu-latest + - name: GITEA_RUNNER_REGISTRATION_TOKEN + valueFrom: + secretKeyRef: + name: act-runner-registration-token + key: token + command: + - /bin/sh + - -ec + args: + - | + if [ -f /data/.runner ]; then + echo "runner already registered" + exit 0 + fi + act_runner --config /config/config.yaml register \ + --no-interactive \ + --instance "${GITEA_INSTANCE_URL}" \ + --token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \ + --name "${GITEA_RUNNER_NAME}" \ + --labels "${GITEA_RUNNER_LABELS}" + volumeMounts: + - name: runner-data + mountPath: /data + - name: runner-config + mountPath: /config containers: - name: dind image: docker:27-dind @@ -42,8 +77,9 @@ spec: - name: DOCKER_TLS_CERTDIR value: "" args: + - --host=tcp://127.0.0.1:2375 - --host=unix:///var/run/docker.sock - - --group=1001 + - --tls=false resources: requests: cpu: 250m @@ -63,17 +99,15 @@ spec: value: /config/config.yaml - name: GITEA_INSTANCE_URL value: https://gitea.mpabi.pl - - name: GITEA_RUNNER_NAME - value: trade-next-sol - - name: GITEA_RUNNER_LABELS - value: ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest,k3s-deploy:docker://docker.gitea.com/runner-images:ubuntu-latest - - name: GITEA_RUNNER_REGISTRATION_TOKEN - valueFrom: - secretKeyRef: - name: act-runner-registration-token - key: token - name: DOCKER_HOST - value: unix:///var/run/docker.sock + value: tcp://127.0.0.1:2375 + command: + - /bin/sh + - -ec + args: + - | + sleep 8 + exec act_runner daemon --config /config/config.yaml resources: requests: cpu: 100m