add cleanup

ci_coverage
s-hertel 4 weeks ago
parent f5f4695db1
commit de6c2eab0f

@ -50,3 +50,7 @@
environment:
HOME: >-
{{ remote_tmp_dir }}
always:
- include_role:
role: test_utils/roles/git-repos
tasks_from: cleanup.yml

@ -1,7 +1,6 @@
repo_path: '{{ remote_tmp_dir }}/git_repositories'
exec: []
git_package: git
git_daemon: git-daemon
repo_path: '{{ remote_tmp_dir }}/git_repositories'
repositories: []
exec: []
serve_timeout: 100

@ -0,0 +1,20 @@
- when: started_daemon is defined
block:
- name: Check if git daemon is running
command: 'pgrep -f "git daemon --export-all --enable=receive-pack --base-path={{ repo_path }} {{ repo_path }}"'
register: pid
ignore_errors: true
- name: Stop the git daemon
command: "kill {{ pid.stdout_lines | first }}"
when: pid.stdout_lines|length> 1
- name: Clean up after async task
async_status:
jid: '{{ started_daemon.ansible_job_id }}'
mode: cleanup
register: status_result
vars:
# https://github.com/ansible/ansible/issues/77450#issuecomment-1437626656
ansible_async_dir: '{{ started_daemon.results_file|dirname }}'
when: started_daemon is defined

@ -31,5 +31,7 @@
when: (found_git is failed or found_daemon is failed) and ansible_facts['os_family'] == 'Alpine'
- name: start git daemon
shell: "git daemon --reuseaddr --export-all --enable=receive-pack --base-path={{ repo_path }} {{ repo_path }}&"
command: "git daemon --export-all --enable=receive-pack --base-path={{ repo_path }} {{ repo_path }}"
async: "{{ serve_timeout }}"
poll: 0
register: started_daemon

Loading…
Cancel
Save