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 when: root_user_check.status==404
block: block:
- name: Create root user - 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 }}" no_log: "{{ gitea_no_log }}"
- name: Check if gerrit user exists - name: Check if gerrit user exists
uri: uri:
@ -214,7 +216,9 @@
cron: cron:
name: pack-git-refs name: pack-git-refs
state: present 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) }}' minute: '{{ 59 | random(seed=inventory_hostname) }}'
hour: '{{ 23 | random(seed=inventory_hostname) }}' hour: '{{ 23 | random(seed=inventory_hostname) }}'
weekday: '*/2' weekday: '*/2'

View File

@ -28,7 +28,9 @@ def test_gitea_listening(host):
assert gitea_proxy.is_listening assert gitea_proxy.is_listening
def test_ulimit(host): 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 " expected = ("STACK max stack size "
"16777216 9223372036854775807 bytes") "16777216 9223372036854775807 bytes")
assert expected in cmd.stdout.split('\n') assert expected in cmd.stdout.split('\n')

View File

@ -25,10 +25,13 @@ def test_gitea_listening(host):
assert gitea_http.is_listening assert gitea_http.is_listening
def test_haproxy_statsd_running(host): def test_haproxy_statsd_running(host):
cmd = host.run("docker inspect haproxy-docker_haproxy-statsd_1") # TODO(clarkb) when everything is using docker compose we can use
out = json.loads(cmd.stdout) # ps --format json and inspect the json document directly. Old
assert out[0]["State"]["Status"] == "running" # docker-compose doesn't support this.
assert out[0]["RestartCount"] == 0 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): def test_haproxy_gitea_connection(host):
cmd = host.run('curl --resolve opendev.org:443:127.0.0.1 ' cmd = host.run('curl --resolve opendev.org:443:127.0.0.1 '