diff --git a/playbooks/roles/gitea/tasks/main.yaml b/playbooks/roles/gitea/tasks/main.yaml index 3965bccaab..940166ab6e 100644 --- a/playbooks/roles/gitea/tasks/main.yaml +++ b/playbooks/roles/gitea/tasks/main.yaml @@ -97,7 +97,9 @@ when: root_user_check.status==404 block: - name: Create root user - command: "docker exec -t gitea-docker_gitea-web_1 gitea admin user create --name root --password {{ gitea_root_password }} --email {{ gitea_root_email }} --admin" + command: > + /usr/local/bin/docker-compose -f /etc/gitea-docker/docker-compose.yaml exec -T gitea-web + gitea admin user create --name root --password {{ gitea_root_password }} --email {{ gitea_root_email }} --admin no_log: "{{ gitea_no_log }}" - name: Check if gerrit user exists uri: @@ -205,7 +207,9 @@ cron: name: pack-git-refs state: present - job: "docker exec -t gitea-docker_gitea-web_1 find /data/git/repositories/ -maxdepth 2 -name *.git -type d -execdir git --git-dir={} gc --quiet \\;" + job: > + /usr/local/bin/docker-compose -f /etc/gitea-docker/docker-compose.yaml exec -T gitea-web + find /data/git/repositories/ -maxdepth 2 -name *.git -type d -execdir git --git-dir={} gc --quiet \; minute: '{{ 59 | random(seed=inventory_hostname) }}' hour: '{{ 23 | random(seed=inventory_hostname) }}' weekday: '*/2' diff --git a/testinfra/test_gitea.py b/testinfra/test_gitea.py index 260d681ed1..42a6a6e7aa 100644 --- a/testinfra/test_gitea.py +++ b/testinfra/test_gitea.py @@ -28,7 +28,9 @@ def test_gitea_listening(host): assert gitea_proxy.is_listening def test_ulimit(host): - cmd = host.run("docker exec gitea-docker_gitea-web_1 prlimit") + cmd = host.run("/usr/local/bin/docker-compose " + "-f /etc/gitea-docker/docker-compose.yaml " + "exec -T gitea-web prlimit") expected = ("STACK max stack size " "16777216 9223372036854775807 bytes") assert expected in cmd.stdout.split('\n') diff --git a/testinfra/test_gitea_lb.py b/testinfra/test_gitea_lb.py index b44c388435..02d7c24334 100644 --- a/testinfra/test_gitea_lb.py +++ b/testinfra/test_gitea_lb.py @@ -25,10 +25,13 @@ def test_gitea_listening(host): assert gitea_http.is_listening def test_haproxy_statsd_running(host): - cmd = host.run("docker inspect haproxy-docker_haproxy-statsd_1") - out = json.loads(cmd.stdout) - assert out[0]["State"]["Status"] == "running" - assert out[0]["RestartCount"] == 0 + # TODO(clarkb) when everything is using docker compose we can use + # ps --format json and inspect the json document directly. Old + # docker-compose doesn't support this. + cmd = host.run("/usr/local/bin/docker-compose " + "-f /etc/haproxy-docker/docker-compose.yaml " + "ps haproxy-statsd") + assert ' Up ' in cmd.stdout def test_haproxy_gitea_connection(host): cmd = host.run('curl --resolve opendev.org:443:127.0.0.1 '