1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix: Allow the runner to keep it's labels (#965)

I had the case that an already registered runner was losing it's labels due to a race condition (I think): the compose file was restarted, the runner came up but 10 seconds later, the labels were reset:

>If the command is run without --labels, they will be reset, and the runner won’t set them back until it is restarted. The --keep-labels option can be used to preserve the existing labels.

I always started all services in the compose file at once, so I never got the idea to restart the runner alone and the runner logs actually always said that the labels where there:

> ... with labels: [docker-cli node-bookworm], declared successfully

Signed-off-by: jankatins <jankatins@noreply.code.forgejo.org>

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/965): <!--number 965 --><!--line 0 --><!--description Zml4OiBBbGxvdyB0aGUgcnVubmVyIHRvIGtlZXAgaXQncyBsYWJlbHM=-->fix: Allow the runner to keep it's labels<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/965
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: jankatins <jankatins@noreply.code.forgejo.org>
Co-committed-by: jankatins <jankatins@noreply.code.forgejo.org>
This commit is contained in:
jankatins 2025-09-08 21:27:43 +00:00 committed by earl-warren
parent 864fce89d2
commit 02df78a9ec
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201

View file

@ -35,7 +35,7 @@ services:
bash -c ' bash -c '
/usr/bin/s6-svscan /etc/s6 & /usr/bin/s6-svscan /etc/s6 &
sleep 10 ; sleep 10 ;
su -c "forgejo forgejo-cli actions register --secret {SHARED_SECRET}" git ; su -c "forgejo forgejo-cli actions register --keep-labels --secret {SHARED_SECRET}" git ;
su -c "forgejo admin user create --admin --username root --password {ROOT_PASSWORD} --email root@example.com" git ; su -c "forgejo admin user create --admin --username root --password {ROOT_PASSWORD} --email root@example.com" git ;
sleep infinity sleep infinity
' '