Add an use a utility service for gerrit commands

We have a need to run ad-hoc commands with the various things
mounted, such as the gerrit init, as well as our friends like
manage-projects. Make a second "service" that doesn't do anything,
but allows us to run "docker-compose run".

Change-Id: Ic9bafe85b90af413c891b969273437be9df6a79f
This commit is contained in:
Monty Taylor 2020-03-20 08:29:02 -05:00
parent 3205133c8a
commit 9b999423b7
2 changed files with 16 additions and 9 deletions

View File

@ -1,14 +1,10 @@
# TODO(mordred) Make this suck less, like if we could do an init container
# or something just generally less gross.
- name: Run gerrit init - name: Run gerrit init
shell:
cmd: >
docker-compose run shell
java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins
chdir: /etc/gerrit-compose/
when: gerrit_run_init | bool when: gerrit_run_init | bool
command: >
docker run --rm --net=host -u gerrit
{% for volume in gerrit_container_volumes %}
-v {{ volume }}
{% endfor %}
{{ gerrit_container_image }}
/usr/local/openjdk-8/bin/java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins
- name: Run docker-compose up - name: Run docker-compose up
shell: shell:

View File

@ -8,4 +8,15 @@ services:
volumes: volumes:
{% for volume in gerrit_container_volumes %} {% for volume in gerrit_container_volumes %}
- {{ volume }} - {{ volume }}
{% endfor %}
# Utility "service" to allow us to run ad-hoc commands
shell:
image: {{ gerrit_container_image }}
restart: 'no'
command: /bin/true
network_mode: host
user: gerrit
volumes:
{% for volume in gerrit_container_volumes %}
- {{ volume }}
{% endfor %} {% endfor %}