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

          James Howe created issue -
          James Howe made changes -
          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.
          James Howe made changes -
          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.

            jgalego João Galego
            jameshowe James Howe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: