Merge "Use docker-compose for container execs in gitea"

This commit is contained in:
Zuul 2024-12-16 20:22:16 +00:00 committed by Gerrit Code Review
commit d6be0ea981
3 changed files with 16 additions and 7 deletions

View File

@ -106,7 +106,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:
@ -214,7 +216,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'

View File

@ -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')

View File

@ -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 '