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

Disabled parametrized jobs could be build from build URL

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • 1.625

      If you use the build URL you could launch disabled parametrized jobs

      1 - Create a Job (any type)
      2 - add a parameter
      3 - copy build URL
      4 - disable the job
      5 - paste the URL on browser and go to it
      6 - the build asks for parameters and could be launch
      7 - the build is keep on queue forever

          [JENKINS-34146] Disabled parametrized jobs could be build from build URL

          Ivan Fernandez Calvo created issue -

          Daniel Beck added a comment - - edited

          Cannot reproduce on 1.642.2. While the page "This build requires parameters" appears, submitting the form does not result in a queue item.

          Apr 12, 2016 4:31:16 PM hudson.model.Executor finish1
          SEVERE: Executor threw an exception
          java.lang.Error: The null Executable has been created for hudson.model.queue.WorkUnit@35711043[work=jobname]. The task cannot be executed
          	at hudson.model.Executor.run(Executor.java:397)
          

          This could probably be improved, but Jenkins does not expose the reported problem (anymore).

          Please make sure issues you report actually occur in current versions of Jenkins.

          Daniel Beck added a comment - - edited Cannot reproduce on 1.642.2. While the page "This build requires parameters" appears, submitting the form does not result in a queue item. Apr 12, 2016 4:31:16 PM hudson.model.Executor finish1 SEVERE: Executor threw an exception java.lang.Error: The null Executable has been created for hudson.model.queue.WorkUnit@35711043[work=jobname]. The task cannot be executed at hudson.model.Executor.run(Executor.java:397) This could probably be improved, but Jenkins does not expose the reported problem (anymore). Please make sure issues you report actually occur in current versions of Jenkins.
          Daniel Beck made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          I could reproduce it on 1.642.3.2

          in ParameterizedJobMixIn ask for parameters before to check if it is asJob().isBuildable()

              public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException {
                  if (delay == null) {
                      delay = new TimeDuration(asJob().getQuietPeriod());
                  }
          
                  // if a build is parameterized, let that take over
                  ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class);
                  if (pp != null && !req.getMethod().equals("POST")) {
                      // show the parameter entry form.
                      req.getView(pp, "index.jelly").forward(req, rsp);
                      return;
                  }
          
                  hudson.model.BuildAuthorizationToken.checkPermission(asJob(), asJob().getAuthToken(), req, rsp);
          
                  if (pp != null) {
                      pp._doBuild(req, rsp, delay);
                      return;
                  }
          
                  if (!asJob().isBuildable()) {
                      throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable"));
                  }
          

          This order solve de problem.

              public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException {
                  if (delay == null) {
                      delay = new TimeDuration(asJob().getQuietPeriod());
                  }
          
                  if (!asJob().isBuildable()) {
                      throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable"));
                  }
          
                  // if a build is parameterized, let that take over
                  ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class);
                  if (pp != null && !req.getMethod().equals("POST")) {
                      // show the parameter entry form.
                      req.getView(pp, "index.jelly").forward(req, rsp);
                      return;
                  }
          

          Ivan Fernandez Calvo added a comment - I could reproduce it on 1.642.3.2 in ParameterizedJobMixIn ask for parameters before to check if it is asJob().isBuildable() public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { if (delay == null ) { delay = new TimeDuration(asJob().getQuietPeriod()); } // if a build is parameterized, let that take over ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class); if (pp != null && !req.getMethod().equals( "POST" )) { // show the parameter entry form. req.getView(pp, "index.jelly" ).forward(req, rsp); return ; } hudson.model.BuildAuthorizationToken.checkPermission(asJob(), asJob().getAuthToken(), req, rsp); if (pp != null ) { pp._doBuild(req, rsp, delay); return ; } if (!asJob().isBuildable()) { throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable" )); } This order solve de problem. public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { if (delay == null ) { delay = new TimeDuration(asJob().getQuietPeriod()); } if (!asJob().isBuildable()) { throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable" )); } // if a build is parameterized, let that take over ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class); if (pp != null && !req.getMethod().equals( "POST" )) { // show the parameter entry form. req.getView(pp, "index.jelly" ).forward(req, rsp); return ; }
          Ivan Fernandez Calvo made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Ivan Fernandez Calvo made changes -
          Assignee New: Ivan Fernandez Calvo [ ifernandezcalvo ]
          Ivan Fernandez Calvo made changes -
          Status Original: Reopened [ 4 ] New: Open [ 1 ]
          Ivan Fernandez Calvo made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Ivan Fernandez Calvo made changes -
          Remote Link New: This issue links to "PR (Web Link)" [ 14201 ]

          I made a pull request with the change https://github.com/jenkinsci/jenkins/pull/2262

          Ivan Fernandez Calvo added a comment - I made a pull request with the change https://github.com/jenkinsci/jenkins/pull/2262

            ifernandezcalvo Ivan Fernandez Calvo
            ifernandezcalvo Ivan Fernandez Calvo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: