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

jenkins-cli quiet-down -block does not block with pipeline jobs

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: cli
    • Environment:
      Jenkins version 2.32.1
      Checked problem can be reproduced with git ver:d111e2ac1658c8fa5fb768e7d1233613b4b9992d
      Running on windows 7 as service
      Recommended plugins installed
      Chrome 55
      Oracle Java 1.8.0_111 64 bit
    • Similar Issues:

      Description

      Running command: java -jar jenkins-cli.jar -s IP quiet-down -block
      Does not seem to work for pipeline jobs.

      With pipeline job running the command returns straight away. The pipeline job then continues until the end of the stage then stops. I expected that the command should not return until all jobs in the queue are finished or reach the end of a stage and are paused.

      With freestyle job running the the command waits for the freestyle job to finish then returns.

      In both cases the command does stop new jobs from been started and shows a red banner with jenkins going for shutdown message on the web interface.

      Running: java -jar jenkins-cli.jar -s IP cancel-quiet-down
      Removes the red banner from the web UI but sometime the job in the queue does not restart and can't be canceled. I have to restart Jenkins. (Maybe this is a separate issue)


      Maybe text for jenkins-cli help quiet-down block option should be changed as this is what lead me to think the behavior was a bug From:

      -block : Block until the system really quiets down and no builds are
      running

      To:

      -block : Block until the system really quiets down and no builds are
      running (except pipeline jobs)

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          Pretty sure this is a feature – Pipelines don't block shutdown/restart as they're resumable.

          Show
          danielbeck Daniel Beck added a comment - Pretty sure this is a feature – Pipelines don't block shutdown/restart as they're resumable.
          Hide
          jdh Joe Hartley added a comment -

          Should't it block a shutdown/restart until any non resumable parts, like bat, have finished?

          Show
          jdh Joe Hartley added a comment - Should't it block a shutdown/restart until any non resumable parts, like bat, have finished?
          Hide
          danielbeck Daniel Beck added a comment -

          non resumable parts, like bat

          https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Nodes+and+Processes+Plugin

          Pipeline steps locking agents and workspaces, and running external processes that may survive a Jenkins restart or slave reconnection.

          Show
          danielbeck Daniel Beck added a comment - non resumable parts, like bat https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Nodes+and+Processes+Plugin Pipeline steps locking agents and workspaces, and running external processes that may survive a Jenkins restart or slave reconnection.
          Hide
          jdh Joe Hartley added a comment -

          Ok, I think I understand:

          From https://go.cloudbees.com/docs/cloudbees-documentation/cookbook/book.html
          "Restartable flows
          All Pipelines are resumable, so if Jenkins needs to be restarted while a flow is running, it should resume at the same point in its execution after Jenkins starts back up. Similarly, if a flow is running a lengthy sh or bat step when an agent unexpectedly disconnects, no progress should be lost when connectivity is restored."

          The original reason I raised this was to continue running some existing standalone build scripts that would wait for jenkins to quite-down before running then start jenkins up again when finished. I have got round blocking not behaving as I expected by using the lockable resource plugin and a dummy while(1) job that sets started/canceled by the external build scripts.

          I'm planning some pipeline jobs that will call long running processes from bat. I guess I will have to live with losing some work or waiting if I need to restart.

          Would it be possible to add a block step to pipeline, eg:

          block

          { //while in block, block shutdown/restart }

          But I guess that should be a new feature request, and this bug should be closed as it is behaving as expected.

          Show
          jdh Joe Hartley added a comment - Ok, I think I understand: From https://go.cloudbees.com/docs/cloudbees-documentation/cookbook/book.html "Restartable flows All Pipelines are resumable, so if Jenkins needs to be restarted while a flow is running, it should resume at the same point in its execution after Jenkins starts back up. Similarly, if a flow is running a lengthy sh or bat step when an agent unexpectedly disconnects, no progress should be lost when connectivity is restored." The original reason I raised this was to continue running some existing standalone build scripts that would wait for jenkins to quite-down before running then start jenkins up again when finished. I have got round blocking not behaving as I expected by using the lockable resource plugin and a dummy while(1) job that sets started/canceled by the external build scripts. I'm planning some pipeline jobs that will call long running processes from bat. I guess I will have to live with losing some work or waiting if I need to restart. Would it be possible to add a block step to pipeline, eg: block { //while in block, block shutdown/restart } But I guess that should be a new feature request, and this bug should be closed as it is behaving as expected.
          Hide
          jdh Joe Hartley added a comment -

          Maybe text for jenkins-cli help quiet-down block option should be changed as this is what lead me to think the behavior was a bug From:
          -block : Block until the system really quiets down and no builds are
          running
          To:
          -block : Block until the system really quiets down and no builds are
          running (except pipeline jobs)

          Show
          jdh Joe Hartley added a comment - Maybe text for jenkins-cli help quiet-down block option should be changed as this is what lead me to think the behavior was a bug From: -block : Block until the system really quiets down and no builds are running To: -block : Block until the system really quiets down and no builds are running (except pipeline jobs)
          Hide
          danielbeck Daniel Beck added a comment -

          The parameter should probably be renamed -safe consistent with safeShutdown / safeExit.

          Show
          danielbeck Daniel Beck added a comment - The parameter should probably be renamed -safe consistent with safeShutdown / safeExit.

            People

            • Assignee:
              Unassigned
              Reporter:
              jdh Joe Hartley
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: