Use docker-compose for container execs in gitea
In preparation for a switch from docker-compose to docker compose (with a shim so that docker-compose is docker compose) we switch away from direct docker exec to using docker-compose exec because the two different compose implementations use different container names. This way we shouldn't need to lookup container names at runtime or have special casing depending on which system we want to use. Instead the compose runtime will find the correct container to exec in based on the human readable name in our config file. Change-Id: I5ffb0007997dfdf2da67df3ada5db4534dc383a7
This commit is contained in:
parent
91d823fd97
commit
cab0b13f5c
@ -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'
|
||||
|
@ -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')
|
||||
|
@ -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 '
|
||||
|
Loading…
x
Reference in New Issue
Block a user