From f0f9f608cc362e234f7570058da739143d9296cb Mon Sep 17 00:00:00 2001 From: Jeff Clement Date: Fri, 1 Nov 2024 22:13:22 -0600 Subject: [PATCH] resolve lost label issue on runners --- forgejo_cloudflare/.env | 3 ++- forgejo_cloudflare/README.md | 6 ------ forgejo_cloudflare/docker-compose.yml | 3 ++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/forgejo_cloudflare/.env b/forgejo_cloudflare/.env index c346bed..2e3871d 100644 --- a/forgejo_cloudflare/.env +++ b/forgejo_cloudflare/.env @@ -33,4 +33,5 @@ ROOT_PASSWORD= ##REQUIRED## SHARED_SECRET= ##REQUIRED## # Runner name / labels -RUNNER_NAME=runner \ No newline at end of file +RUNNER_NAME=runner +RUNNER_LABELS='[\"docker:docker://code.forgejo.org/oci/node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]' \ No newline at end of file diff --git a/forgejo_cloudflare/README.md b/forgejo_cloudflare/README.md index c797d8d..8bd9f72 100644 --- a/forgejo_cloudflare/README.md +++ b/forgejo_cloudflare/README.md @@ -24,9 +24,3 @@ https://www.straybits.ca/2014/self-hosted-git-server/ 7. Wait a bit more 8. Visit `https://git.yourdomain.com` in your browser and login with the admin credentials in your `.env` file. 9. Verify settings. (i.e. do you want to disable user signups, etc.) - -## Known Issue - -### Disappearing Runner Labels - -If your runner labels disappear after a restart, you may need to update your runner's `config.yml` to have the same list of runners as found in your `.runner` file. \ No newline at end of file diff --git a/forgejo_cloudflare/docker-compose.yml b/forgejo_cloudflare/docker-compose.yml index d26e8db..d91fbdc 100644 --- a/forgejo_cloudflare/docker-compose.yml +++ b/forgejo_cloudflare/docker-compose.yml @@ -87,9 +87,10 @@ services: forgejo-runner create-runner-file --connect --instance http://server:3000 --name ${RUNNER_NAME} --secret ${SHARED_SECRET} && break ; sleep 1 ; done ; - sed -i -e "s|\"labels\": null|\"labels\": [\"docker:docker://code.forgejo.org/oci/node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]|" .runner ; + sed -i -e "s|\"labels\": null|\"labels\": ${RUNNER_LABELS}|" .runner ; forgejo-runner generate-config > config.yml ; sed -i -e "s|network: .*|network: host|" config.yml ; + sed -i -e "s|^ labels: \[\]$$| labels: ${RUNNER_LABELS}|" config.yml ; sed -i -e "s|^ envs:$$| envs:\n DOCKER_HOST: tcp://docker:2376\n DOCKER_TLS_VERIFY: 1\n DOCKER_CERT_PATH: /certs/client|" config.yml ; sed -i -e "s|^ options:| options: -v /certs/client:/certs/client|" config.yml ; sed -i -e "s| valid_volumes: \[\]$$| valid_volumes:\n - /certs/client|" config.yml ;