Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39187

Pipeline timeout should still raise an error if a terminated shell command exits normally

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.25; Pipeline 2.2; Pipeline: Basic Steps 2.2; Pipeline Nodes and Processes 2.5; Pipeline: Supporting Apis 2.10

      The timeout pipeline step will send an TERM signal to an inner process when its time window ends. If that inner process is listening for TERM and exits normally when it sees one - it seems that no other error appears in the jenkins pipeline. Later tasks within the `timeout` block still execute and no exception is caught by the pipeline.

      I hit this by running docker containers in docker-compose wrapping `python -m unittest` - all combined that ends up exiting with code 0 on termination.

      I expect I can work around this, but the behavior seemed unexpected enough (timeout followed by ... no errors) to file this issue.

      Update: looks like (in this case) the behavior comes from `docker-compose exec`.

      as a workaround I'm able to use `docker exec` which returns non-zero when terminated.

      example groovy step:

      timeout (time: 1, unit: 'SECONDS') {
          sh 'docker-compose alpine sleep 10'
          echo('sleep complete (should not get here)')
      }
      

      docker-compose:

      version: '2'
      services:
        alpine:
          image: alpine
          command: bash
          tty: true
      

            Unassigned Unassigned
            jett_bonsai Jett Jones
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: