-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
Currently I've built my own in a custom library
def call(Closure body) { docker.withTool('Default') { withPythonEnv('python') { sh 'pip install docker-compose' sh 'docker-compose --no-ansi up -d' try { waitUntil { script { dockerUtils.isReady() } } body() } finally { sh 'docker-compose --no-ansi down' } } } }
The isReady() function is a little complicated - it essentially does
docker inspect --format '{{json .State}}' $(docker-compose ps -q)
then parses and checks that every container has either Health.Status == 'healthy', or Status == 'running' if there is no healthcheck.
You could implement something similar, and more configurable, directly.
[JENKINS-56346] Provide build wrapper withDockerCompose
Description |
Original:
Currently I've built my own in a custom library {code:groovy} def call(Closure body) { withPythonEnv('python') { sh 'pip install docker-compose' sh 'docker-compose --no-ansi up -d' try { waitUntil { script { dockerUtils.isReady() } } body() } finally { sh 'docker-compose --no-ansi down' } } } {code} The {{isReady()}} function is a little complicated - it essentially does {code:sh} docker inspect --format '{{json .State}}' $(docker-compose ps -q) {code}then parses and checks that every container has either {{Health.Status == 'healthy'}}, or {{Status == 'running'}} if there is no healthcheck. You could implement something similar, and more configurable, directly. |
New:
Currently I've built my own in a custom library {code} def call(Closure body) { docker.withTool('Default') { withPythonEnv('python') { sh 'pip install docker-compose' sh 'docker-compose --no-ansi up -d' try { waitUntil { script { dockerUtils.isReady() } } body() } finally { sh 'docker-compose --no-ansi down' } } } } {code} The {{isReady()}} function is a little complicated - it essentially does {code} docker inspect --format '{{json .State}}' $(docker-compose ps -q) {code} then parses and checks that every container has either {{Health.Status == 'healthy'}}, or {{Status == 'running'}} if there is no healthcheck. You could implement something similar, and more configurable, directly. |
Description |
Original:
Currently I've built my own in a custom library {code} def call(Closure body) { docker.withTool('Default') { withPythonEnv('python') { sh 'pip install docker-compose' sh 'docker-compose --no-ansi up -d' try { waitUntil { script { dockerUtils.isReady() } } body() } finally { sh 'docker-compose --no-ansi down' } } } } {code} The {{isReady()}} function is a little complicated - it essentially does {code} docker inspect --format '{{json .State}}' $(docker-compose ps -q) {code} then parses and checks that every container has either {{Health.Status == 'healthy'}}, or {{Status == 'running'}} if there is no healthcheck. You could implement something similar, and more configurable, directly. |
New:
Currently I've built my own in a custom library {code:groovy} def call(Closure body) { docker.withTool('Default') { withPythonEnv('python') { sh 'pip install docker-compose' sh 'docker-compose --no-ansi up -d' try { waitUntil { script { dockerUtils.isReady() } } body() } finally { sh 'docker-compose --no-ansi down' } } } } {code} The {{isReady()}} function is a little complicated - it essentially does {code:sh} docker inspect --format '{{json .State}}' $(docker-compose ps -q) {code} then parses and checks that every container has either {{Health.Status == 'healthy'}}, or {{Status == 'running'}} if there is no healthcheck. You could implement something similar, and more configurable, directly. |