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

Build Token Root returns 404 error - Possibly Proxy/Auth issue?

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • None
    • Ubuntu 14.01
      Jenkins 1.609.2
      Build Root Token Plugin 1.3

      Our Jenkins servers require "auth-no-challenge" and "no-proxy" flags to be passed to wget when triggering builds.
      I installed the Build Root Token Plugin today and attempted to use the buildByToken URI.
      It failed. It is not clear why.
      The documentation indicates it should "just work".
      The only thing different about my environment are the flags which need to be passed to wget.

      ===============================
      Regular URI, is successful:
      ===============================

      $ wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/job/mchon_admin/buildWithParameters?token=SECONDSTREET&FULL_WIPE=false
      [1] 22861
      mchon@gollum:~/cid-dev/Cid$ 2015-09-04 15:02:30 https://jenkins.am.blah.com/job/mchon_admin/buildWithParameters?token=SECONDSTREET
      Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200
      Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected.
      HTTP request sent, awaiting response... 201 Created
      Length: 0
      Saving to: ‘buildWithParameters?token=SECONDSTREET.3’

      [ <=> ] 0 --.-K/s in 0s

      2015-09-04 15:02:30 (0.00 B/s) - ‘buildWithParameters?token=SECONDSTREET.3’ saved [0/0]

      [1]+ Done wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/job/mchon_admin/buildWithParameters?token=SECONDSTREET

      ===============================
      buildByToken URI, fails:
      ===============================

      {{$ wget --auth-no-challenge --no-proxy https://jenkins.am.blah.com/job/mchon_admin/buildByToken/buildWithParameters?token=SECONDSTREET&FULL_WIPE=false
      [1] 22948
      mchon@gollum:~/cid-dev/Cid$ 2015-09-04 15:03:33 https://jenkins.am.blah.com/job/mchon_admin/buildByToken/buildWithParameters?token=SECONDSTREET
      Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200
      Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected.
      HTTP request sent, awaiting response... 404 Not Found
      2015-09-04 15:03:34 ERROR 404: Not Found.

      [1]+ Exit 8 wget --auth-no-challenge --no-proxy https://jenkins.am.blah.com/job/mchon_admin/buildByToken/buildWithParameters?token=SECONDSTREET}}

          [JENKINS-30315] Build Token Root returns 404 error - Possibly Proxy/Auth issue?

          M Chon added a comment -

          BTW, in checking the Jenkins log, neither event (succesfully triggered, or unsuccessfully triggered) appears in the log upon launch. Only the successful build appears in the log upon completion:

          INFO: mchon_admin #25 main build action completed: SUCCESS

          M Chon added a comment - BTW, in checking the Jenkins log, neither event (succesfully triggered, or unsuccessfully triggered) appears in the log upon launch. Only the successful build appears in the log upon completion: INFO: mchon_admin #25 main build action completed: SUCCESS

          Jesse Glick added a comment -

          You are not using the right URLs. Read the plugin documentation.

          Jesse Glick added a comment - You are not using the right URLs. Read the plugin documentation.

          M Chon added a comment - - edited

          Oops!

          OK, I changed my URL but now I am getting a 403 instead of a 404:

          mchon@gollum:~$ wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false
          [1] 19825
          [2] 19826
          mchon@gollum:~$ -2015-09-08 12:36:43- https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin
          Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200
          Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected.
          HTTP request sent, awaiting response... 403 Forbidden
          2015-09-08 12:36:43 ERROR 403: Forbidden.

          [1]- Exit 8 wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin
          [2]+ Done token=SECONDSTREET

          M Chon added a comment - - edited Oops! OK, I changed my URL but now I am getting a 403 instead of a 404: mchon@gollum:~$ wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false [1] 19825 [2] 19826 mchon@gollum:~$ - 2015-09-08 12:36:43 - https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200 Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected. HTTP request sent, awaiting response... 403 Forbidden 2015-09-08 12:36:43 ERROR 403: Forbidden. [1] - Exit 8 wget -v --auth-no-challenge --no-proxy https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin [2] + Done token=SECONDSTREET

          Jesse Glick added a comment -

          First, be sure to quote your URL from a Bourne shell to avoid interpretation of shell metacharacters.

          Second, create a logger recording org.jenkinsci.plugins.build_token_root at FINE in your server and look at that for detailed diagnostics. There are various reasons you could get a 403 and the plugin intentionally does not report them in the web response.

          Jesse Glick added a comment - First, be sure to quote your URL from a Bourne shell to avoid interpretation of shell metacharacters. Second, create a logger recording org.jenkinsci.plugins.build_token_root at FINE in your server and look at that for detailed diagnostics. There are various reasons you could get a 403 and the plugin intentionally does not report them in the web response.

          M Chon added a comment -

          Jesse,

          My apologies for the fuss. You may close the ticket.

          After I single-quoted the URL (in bash), it is now working. I get a 201.
          Strangely, I did not have to single-quote the URL when invoking it normally (i.e. non-Build Token, as pasted in my first example.)

          mchon@gollum:~$ wget --auth-no-challenge --no-proxy 'https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false'
          -2015-09-08 13:01:25- https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false
          Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200
          Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected.
          HTTP request sent, awaiting response... 201 Created
          Length: 0
          Saving to: ‘buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false.1’

          [ <=> ] 0 --.-K/s in 0s

          2015-09-08 13:01:25 (0.00 B/s) - ‘buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false.1’ saved [0/0]

          M Chon added a comment - Jesse, My apologies for the fuss. You may close the ticket. After I single-quoted the URL (in bash), it is now working. I get a 201. Strangely, I did not have to single-quote the URL when invoking it normally (i.e. non-Build Token, as pasted in my first example.) mchon@gollum:~$ wget --auth-no-challenge --no-proxy 'https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false' - 2015-09-08 13:01:25 - https://jenkins.am.blah.com/buildByToken/buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false Resolving jenkins.am.blah.com (jenkins.am.blah.com)... 43.148.4.200 Connecting to jenkins.am.blah.com (jenkins.am.blah.com)|43.148.4.200|:443... connected. HTTP request sent, awaiting response... 201 Created Length: 0 Saving to: ‘buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false.1’ [ <=> ] 0 --.-K/s in 0s 2015-09-08 13:01:25 (0.00 B/s) - ‘buildWithParameters?job=mchon_admin&token=SECONDSTREET&FULL_WIPE=false.1’ saved [0/0]

          Jesse Glick added a comment -

          Because it was only &FULL_WIPE=false that was being ignored, and that query parameter was not required for authentication (only for correct results). With this plugin, if &token=SECONDSTREET&FULL_WIPE=false is omitted, authentication fails too.

          BTW the plugin wiki does try to remind you to quote your URLs. Could probably stand some editing for clarity.

          Jesse Glick added a comment - Because it was only &FULL_WIPE=false that was being ignored, and that query parameter was not required for authentication (only for correct results). With this plugin, if &token=SECONDSTREET&FULL_WIPE=false is omitted, authentication fails too. BTW the plugin wiki does try to remind you to quote your URLs. Could probably stand some editing for clarity.

            jglick Jesse Glick
            mcsf M Chon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: