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

Jenkins Remote API - Queue behavior changed

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          Code changed in jenkins
          User: tfennelly
          Path:
          changelog.html
          cli/pom.xml
          core/pom.xml
          core/src/main/java/hudson/model/AbstractItem.java
          debian/debian/changelog
          plugins/pom.xml
          pom.xml
          test/pom.xml
          war/pom.xml
          http://jenkins-ci.org/commit/jenkins/7e5063937c31ee33de29254f1f13f5d4aa0d6174
          Log:
          Merge branch 'master' into JENKINS-27256

          • master:
            Updated changelog
            updated changelog as a part of the release
            [maven-release-plugin] prepare for next development iteration
            [maven-release-plugin] prepare release jenkins-1.604
            Noting #1597
            Noting #1593, #1579, move JENKINS-22346, #1558
            Remove two fixes that were backported to RC
            JENKINS-27183 Avoid deadlock when using build-monitor-plugin
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: changelog.html cli/pom.xml core/pom.xml core/src/main/java/hudson/model/AbstractItem.java debian/debian/changelog plugins/pom.xml pom.xml test/pom.xml war/pom.xml http://jenkins-ci.org/commit/jenkins/7e5063937c31ee33de29254f1f13f5d4aa0d6174 Log: Merge branch 'master' into JENKINS-27256 master: Updated changelog updated changelog as a part of the release [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release jenkins-1.604 Noting #1597 Noting #1593, #1579, move JENKINS-22346 , #1558 Remove two fixes that were backported to RC JENKINS-27183 Avoid deadlock when using build-monitor-plugin

          Code changed in jenkins
          User: Tom Fennelly
          Path:
          core/pom.xml
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/6bdd321228e1d8bcea43622c0af4b4cd9eedbc74
          Log:
          Merge pull request #1603 from tfennelly/JENKINS-27256

          [FIXED JENKINS-27256] Added functional test for stapler fix

          Compare: https://github.com/jenkinsci/jenkins/compare/11786d8858df...6bdd321228e1

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Tom Fennelly Path: core/pom.xml test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/6bdd321228e1d8bcea43622c0af4b4cd9eedbc74 Log: Merge pull request #1603 from tfennelly/ JENKINS-27256 [FIXED JENKINS-27256] Added functional test for stapler fix Compare: https://github.com/jenkinsci/jenkins/compare/11786d8858df...6bdd321228e1

          Code changed in jenkins
          User: tfennelly
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/73c3021b70807fec81895ef3cee805bbb694d4b9
          Log:
          Noting JENKINS-27256

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: changelog.html http://jenkins-ci.org/commit/jenkins/73c3021b70807fec81895ef3cee805bbb694d4b9 Log: Noting JENKINS-27256
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #4011
          [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods (Revision ad9d191cbcee8928744d375bc13c629bd470329b)

          Result = SUCCESS
          tom.fennelly : ad9d191cbcee8928744d375bc13c629bd470329b
          Files :

          • core/pom.xml
          • test/src/test/java/hudson/model/QueueTest.java
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #4011 [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods (Revision ad9d191cbcee8928744d375bc13c629bd470329b) Result = SUCCESS tom.fennelly : ad9d191cbcee8928744d375bc13c629bd470329b Files : core/pom.xml test/src/test/java/hudson/model/QueueTest.java

          Code changed in jenkins
          User: Daniel Beck
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/f6fa3c79c67521a801c01a99475b3f31fe2c0bf1
          Log:
          Noting JENKINS-27256 more user friendly

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: changelog.html http://jenkins-ci.org/commit/jenkins/f6fa3c79c67521a801c01a99475b3f31fe2c0bf1 Log: Noting JENKINS-27256 more user friendly

          People

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

            Dates

              Created:
              Updated:
              Resolved: