• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core
    • Jenkins >= 1.601

      Please look at the following comment:

      https://issues.jenkins-ci.org/browse/JENKINS-12827?focusedCommentId=201381&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-201381

      This behavior does not work anymore in Jenkins 1.601.
      The queue item URL which is in the location header of the start-build URL returns HTTP status code 404.

      Steps to reproduce the problem

      Start build via Remote API

      The initial request was:

      http://myjenkins/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/build

      The HTTP header contains the correct location URL:

      HTTP/1.1 201 Created
      Date: ...
      Server: ...
      Location: http://myjenkins/queue/item/68/
      

      Queue object while build is in the queue

      That works in all used Jenkins versions.
      URL: https://myjenkins:8081/queue/api/json
      JSON response:

      {
          "items": 
      [
      {
          "actions": 
      [
      {
          "causes": 
      [
                  {
                      "shortDescription": "Started by user XYZ",
                      "userId": "xyz",
                      "userName": "xyz"
                  }
              ]
          }
      ],
      "blocked": false,
      "buildable": false,
      "id": 68,
      "inQueueSince": 1425545634280,
      "params": "",
      "stuck": false,
      "task":
                  {
                      "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8",
                      "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/",
                      "color": "notbuilt"
                  },
                  "url": "queue/item/68/",
                  "why": "In the quiet period. Expires in 4.2 sec",
                  "timestamp": 1425545639280
              }
          ]
      }
      

      Queue item object while build is in the queue

      That does not work anymore in Jenkins 1.601. The following queue item URL is not found (HTTP status code 404).
      URL: https://myjenkins:8081/queue/item/68/api/json
      JSON response:

      {
          "actions": 
      [
      {
          "causes": 
      [
                  {
                      "shortDescription": "Started by user xyz
                      "userId": "xyz",
                      "userName": "xyz"
                  }
              ]
          }
      ],
      "blocked": false,
      "buildable": false,
      "id": 68,
      "inQueueSince": 1425545634280,
      "params": "",
      "stuck": false,
      "task":
      {
          "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8",
          "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/",
          "color": "blue"
      },
      "url": "queue/item/68/",
      "why": null,
      "cancelled": false,
      "executable":
          {
              "number": 1,
              "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/1/"
          }
      }
      

      Cause of the issue

      The reasons of the problem could be:

      1. The quiet period parameter is ignored. (In our case in it is 5 seconds by default.) That would mean, that queue item is deleted very fast and could not be requested properly.
      2. Maybe the queue item URL is not yet created anymore.

      Possible Solution

      In my opinion the solution would be to make the queue item URL still accessible even if the queue item is deleted. For our build workflow that would be a fine solution.

      Or is there any other way to request finished queue items?

      Goal

      Our goal is to track a Jenkins build via external tools. So if there is another way to safely track a started build, please let me know.

          [JENKINS-27256] Jenkins Remote API - Queue behavior changed

          Christian Gnüchtel created issue -
          Daniel Beck made changes -
          Labels Original: queue remote New: queue regression remote

          Daniel Beck added a comment -

          Thanks for the report!

          This broke due to PR 1566.

          My analysis on Github: https://github.com/jenkinsci/jenkins/pull/1566/files#r25853828

          Daniel Beck added a comment - Thanks for the report! This broke due to PR 1566. My analysis on Github: https://github.com/jenkinsci/jenkins/pull/1566/files#r25853828
          Jesse Glick made changes -
          Assignee New: Tom FENNELLY [ tfennelly ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jesse Glick added a comment -

          Apparently there were no test cases exercising the remote API for the queue.

          Jesse Glick added a comment - Apparently there were no test cases exercising the remote API for the queue.

          Jesse Glick added a comment -

          Need a patch to Stapler.

          Jesse Glick added a comment - Need a patch to Stapler.

          This bug has just broken all CI infrastructure at my organization and we had to downgrade to 1.600.

          Some more investigation:

          • quiet period is NOT ignored and the item actually does await in the queue until the quiet period expires
          • during the quiet period queue api (JENKINS_URL/queue/api/json) does show an item in it, but any attempt to access item's api (JENKINS_URL/queue/item/ITEM_ID/api/json), even while the item is in the quiet period results in 404
          • after the quiet period expires any attempt to access item's api also results in 404, although it should be accessible for 5 more minutes: https://issues.jenkins-ci.org/browse/JENKINS-26228?focusedCommentId=218310#comment-218310

          Morgwai Kotarbinski added a comment - This bug has just broken all CI infrastructure at my organization and we had to downgrade to 1.600. Some more investigation: quiet period is NOT ignored and the item actually does await in the queue until the quiet period expires during the quiet period queue api (JENKINS_URL/queue/api/json) does show an item in it, but any attempt to access item's api (JENKINS_URL/queue/item/ITEM_ID/api/json), even while the item is in the quiet period results in 404 after the quiet period expires any attempt to access item's api also results in 404, although it should be accessible for 5 more minutes: https://issues.jenkins-ci.org/browse/JENKINS-26228?focusedCommentId=218310#comment-218310

          As I understand https://github.com/jenkinsci/jenkins/pull/1566/ does not solve https://issues.jenkins-ci.org/browse/JENKINS-26445 yet, so could we please revert it until it's fixed in a way not to break queue api?

          Morgwai Kotarbinski added a comment - As I understand https://github.com/jenkinsci/jenkins/pull/1566/ does not solve https://issues.jenkins-ci.org/browse/JENKINS-26445 yet, so could we please revert it until it's fixed in a way not to break queue api?

          Daniel Beck added a comment -

          That would be an incompatible change to a released version, something usually avoided.

          In fact, the fix (in Stapler) appears to be pretty trivial, it just needs to be done...

          Daniel Beck added a comment - That would be an incompatible change to a released version, something usually avoided. In fact, the fix (in Stapler) appears to be pretty trivial, it just needs to be done...

            tfennelly Tom FENNELLY
            fastblitzer Christian Gnüchtel
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: