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

buildWithParameters does not work when project has not been built before parameters configured

      Build is a github project on the latest everything.

      Jenkins v 2.45
      AWS Linux (centos fork)

      Attempting to build github branches with slashes in them returns a 403

      marc is missing the Job/Build permission

      Authorization is set so that

      Any logged in user can do anything

      This problem does not exist on branches without slashes in them.

        1. config.xml
          2 kB
        2. jenkins.gif
          jenkins.gif
          7.28 MB
        3. Screen Shot 2017-02-08 at 4.12.19 PM.png
          Screen Shot 2017-02-08 at 4.12.19 PM.png
          36 kB
        4. Screen Shot 2017-02-08 at 4.12.26 PM.png
          Screen Shot 2017-02-08 at 4.12.26 PM.png
          35 kB
        5. slash-params.gif
          slash-params.gif
          354 kB

          [JENKINS-41865] buildWithParameters does not work when project has not been built before parameters configured

          I see, you are using evil job type. Reassigning to authors.

          Kanstantsin Shautsou added a comment - I see, you are using evil job type. Reassigning to authors.

          How are you attempting to build them?

          Stephen Connolly added a comment - How are you attempting to build them?

          marc young added a comment - - edited

          Via UI by add `/buildWithParameters` to verify, but with http://github.com/openstack/python-jenkins is how I first noticed it.
          I use a slackbot to run our CI job to pass params. It's been fine from Jenkins 1.x to 2.45 calling 'master' with params, but I noticed when I started building branches (was just building github PR's before) that it was blowing up on items with a `/` in it.
          PR's are just

          PR-####

          so that was fine.

          bugfix_foo

          is fine, but

          bugfix/foo

          blow up in: python library, curl, and browser (seen in SS)

          By blow up I mean the browser, curl, and the python library all return a 403 unauthorized. switching to any branch/PR with no slash builds perfectly

          marc young added a comment - - edited Via UI by add `/buildWithParameters` to verify, but with http://github.com/openstack/python-jenkins is how I first noticed it. I use a slackbot to run our CI job to pass params. It's been fine from Jenkins 1.x to 2.45 calling 'master' with params, but I noticed when I started building branches (was just building github PR's before) that it was blowing up on items with a `/` in it. PR's are just PR-#### so that was fine. bugfix_foo is fine, but bugfix/foo blow up in: python library, curl, and browser (seen in SS) By blow up I mean the browser, curl, and the python library all return a 403 unauthorized. switching to any branch/PR with no slash builds perfectly

          So what happens when you double encode the slash? Eg bugfix%252Ffoo

          (You need to double encode it to bypass browser decoding as a "help"

          Stephen Connolly added a comment - So what happens when you double encode the slash? Eg bugfix%252Ffoo (You need to double encode it to bypass browser decoding as a "help"

          marc young added a comment -

          That was my attempt after doing a normal URL encode, did not help. That's actually included in the SS

          marc young added a comment - That was my attempt after doing a normal URL encode, did not help. That's actually included in the SS

          So it works for me!

          What servlet container are you using?

          Stephen Connolly added a comment - So it works for me! What servlet container are you using?

          marc young added a comment - - edited

          stephenc how do i check?

          It's jenkins 2.45 built via https://github.com/saltstack-formulas/jenkins-formula

          I installed from scratch on this demo.

          The only other thing is I'm using Jenkinsfile to define my parameters. Which means the first time it runs, it does not know about the parameters, after build #1 it knows.
          If you look at the gif i attached, towards the end, any branches with a

          /

          dont have the option to 'build with parameters' because I can't initially build it.

          Also: using this setup, no jobs allow me to build them. Slash or not, there is no "build" button for the job, so "Buidl with parameters" only shows up on parameterized builds. Is it an issue with state? It does not know about my parameters until it builds it, but i cannot build it because it doesn't have parameters?

          marc young added a comment - - edited stephenc how do i check? It's jenkins 2.45 built via https://github.com/saltstack-formulas/jenkins-formula I installed from scratch on this demo. The only other thing is I'm using Jenkinsfile to define my parameters. Which means the first time it runs, it does not know about the parameters, after build #1 it knows. If you look at the gif i attached, towards the end, any branches with a / dont have the option to 'build with parameters' because I can't initially build it. Also: using this setup, no jobs allow me to build them. Slash or not, there is no "build" button for the job, so "Buidl with parameters" only shows up on parameterized builds. Is it an issue with state? It does not know about my parameters until it builds it, but i cannot build it because it doesn't have parameters?

          So after chatting on IRC, this seems to be a confluence of different things:

          1. It is somewhat confusing in the UI differentiating between a branch that has never been built and a dead branch. (Hint: currently the dead branches cannot be built but can be deleted... live branches cannot be deleted but can be built)
          2. BuildWithParameters URL is not available until the Jenkinsfile has been loaded for the branch and the parameter definition applied

          Stephen Connolly added a comment - So after chatting on IRC, this seems to be a confluence of different things: 1. It is somewhat confusing in the UI differentiating between a branch that has never been built and a dead branch. (Hint: currently the dead branches cannot be built but can be deleted... live branches cannot be deleted but can be built) 2. BuildWithParameters URL is not available until the Jenkinsfile has been loaded for the branch and the parameter definition applied

          https://issues.jenkins-ci.org/browse/JENKINS-41927 created to help disambiguate orphaned items

          Stephen Connolly added a comment - https://issues.jenkins-ci.org/browse/JENKINS-41927 created to help disambiguate orphaned items

          Jesse Glick added a comment -

          I think this should let you go ahead and submit parameters. Ditto here. ParametersAction already refuses to set environment variables for undeclared parameters, so there should no risk in that. Similarly, this should be more lenient. Of course for undeclared parameters we do not know the type, so we could just create StringParameterValue in all cases.

          Jesse Glick added a comment - I think this should let you go ahead and submit parameters. Ditto here . ParametersAction already refuses to set environment variables for undeclared parameters, so there should no risk in that. Similarly, this should be more lenient. Of course for undeclared parameters we do not know the type, so we could just create StringParameterValue in all cases.

            Unassigned Unassigned
            myoung34 marc young
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: