fix: guard all systemctl --user tasks with docker_rootless_setup
The daemon-reload, service restart, and service check tasks in service.yml, prune.yml, update_runner.yml, and integration_test.yml were not guarded by docker_rootless_setup. In CI containers without a systemd user bus, these tasks fail with "Failed to connect to bus". Also fix the integration_test.yml validation task to not fail on service status when docker_rootless_setup is false. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
c271293b2d
commit
8579a4064f
@@ -26,6 +26,9 @@
|
|||||||
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
||||||
register: service_check
|
register: service_check
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- systemd_available.stat.exists
|
||||||
|
- docker_rootless_setup
|
||||||
|
|
||||||
- name: Validate runner installation
|
- name: Validate runner installation
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
@@ -34,12 +37,12 @@
|
|||||||
{% if not (runner_file_stat.stat.exists | default(false)) %}
|
{% if not (runner_file_stat.stat.exists | default(false)) %}
|
||||||
- Registration file (.runner) is missing. Registration may have failed.
|
- Registration file (.runner) is missing. Registration may have failed.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not (service_check.stdout | default('') | trim) == 'active' %}
|
{% if docker_rootless_setup and not (service_check.stdout | default('') | trim) == 'active' %}
|
||||||
- Systemd user service is not active.
|
- Systemd user service is not active.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
when: >
|
when: >
|
||||||
not (runner_file_stat.stat.exists | default(false))
|
not (runner_file_stat.stat.exists | default(false))
|
||||||
or not (service_check.stdout | default('') | trim) == 'active'
|
or (docker_rootless_setup and not (service_check.stdout | default('') | trim) == 'active')
|
||||||
|
|
||||||
- name: Report runner status
|
- name: Report runner status
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
environment:
|
environment:
|
||||||
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
when:
|
||||||
|
- systemd_available.stat.exists
|
||||||
|
- docker_rootless_setup
|
||||||
|
|
||||||
- name: Enable and start docker-prune user timer
|
- name: Enable and start docker-prune user timer
|
||||||
ansible.builtin.command: systemctl --user enable --now docker-prune.timer
|
ansible.builtin.command: systemctl --user enable --now docker-prune.timer
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
environment:
|
environment:
|
||||||
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
when:
|
||||||
|
- systemd_available.stat.exists
|
||||||
|
- docker_rootless_setup
|
||||||
|
|
||||||
- name: Enable and start gitea-runner user service
|
- name: Enable and start gitea-runner user service
|
||||||
ansible.builtin.command: systemctl --user enable --now gitea-runner
|
ansible.builtin.command: systemctl --user enable --now gitea-runner
|
||||||
|
|||||||
@@ -8,5 +8,7 @@
|
|||||||
become_user: "{{ gitea_runner_service_user }}"
|
become_user: "{{ gitea_runner_service_user }}"
|
||||||
environment:
|
environment:
|
||||||
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
|
||||||
when: systemd_available.stat.exists | default(false) | bool
|
when:
|
||||||
|
- systemd_available.stat.exists | default(false) | bool
|
||||||
|
- docker_rootless_setup
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|||||||
Reference in New Issue
Block a user