diff --git a/cicd/config/config.toml b/cicd/config/config.toml new file mode 100644 index 00000000..6c2ab68c --- /dev/null +++ b/cicd/config/config.toml @@ -0,0 +1,21 @@ +concurrent = 1 +check_interval = 0 + +[session_server] + session_timeout = 1800 + +[[runners]] + [runners.custom_build_dir] + [runners.cache] + [runners.cache.s3] + [runners.cache.gcs] + [runners.cache.azure] + [runners.docker] + privileged = true + tls_verify = false + disable_entrypoint_overwrite = false + oom_kill_disable = false + disable_cache = false + volumes = ["/cache"] + shm_size = 0 + diff --git a/cicd/config/template.config.toml b/cicd/config/template.config.toml new file mode 100644 index 00000000..f973b917 --- /dev/null +++ b/cicd/config/template.config.toml @@ -0,0 +1,3 @@ +[[runners]] + [runners.docker] + privileged = true diff --git a/cicd/docker-install.yaml b/cicd/docker-install.yaml index cf683c14..52fd9cbe 100644 --- a/cicd/docker-install.yaml +++ b/cicd/docker-install.yaml @@ -21,10 +21,14 @@ - docker-compose-plugin - name: install-earthly ansible.builtin.script: ./earthly-setup.sh - - name: install-gitlab-runner-config + - name: copy-config ansible.builtin.copy: - src: template.config.toml - dest: /srv/gitlab-runner/config/ + src: ./config/config.toml + dest: /etc/gitlab-runner/ + - name: copy-config-template + ansible.builtin.copy: + src: ./config/template.config.toml + dest: /tmp/gitlab-runner/ - name: install-gitlab-runner ansible.builtin.script: ./gitlab-runner.sh install - name: register-gitlab-runner diff --git a/cicd/earthly-setup.sh b/cicd/earthly-setup.sh index 0b8321ce..8377c2cf 100755 --- a/cicd/earthly-setup.sh +++ b/cicd/earthly-setup.sh @@ -3,7 +3,8 @@ docker run -d --restart always \ --privileged \ --name earthly-buildkit \ - -p 8372:8372 \ - -t -v earthly-tmp:/tmp/earthly:rw \ + -t -p 8372:8372 \ + -v earthly-tmp:/tmp/earthly:rw \ + -v /var/run/docker.sock:/var/run/docker.sock \ --env BUILDKIT_TCP_TRANSPORT_ENABLED=true \ earthly/buildkitd:v0.6.28 diff --git a/cicd/gitlab-runner.sh b/cicd/gitlab-runner.sh index 2b0674c5..f5cad329 100755 --- a/cicd/gitlab-runner.sh +++ b/cicd/gitlab-runner.sh @@ -9,15 +9,19 @@ install () { } register () { + docker run --rm -it \ - -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ + -v /srv/gitlab-runner/config:/etc/gitlab-runner \ + -v /tmp/gitlab-runner:/tmp/gitlab-runner \ + gitlab/gitlab-runner register \ + --config /etc/gitlab-runner/config.toml \ + --template-config /tmp/gitlab-runner/template.config.toml \ --non-interactive \ --executor "docker" \ --docker-image alpine:latest \ --url "${CI_SERVER_URL}" \ --registration-token "${REGISTRATION_TOKEN}" \ --description "${RUNNER_NAME}" \ - --template-config /srv/gitlab-runner/config/template.config.toml \ --tag-list "amd64,linux" } diff --git a/cicd/template.config.toml b/cicd/template.config.toml deleted file mode 100644 index d33f8247..00000000 --- a/cicd/template.config.toml +++ /dev/null @@ -1,6 +0,0 @@ -[[runners]] - executor = "docker" - [runners.docker] - tls_verify = false - image = "alpine:latest" - privileged = true