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

Disabled parametrized jobs could be build from build URL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      1.625
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck 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.

            Show
            danielbeck 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.
            Hide
            ifernandezcalvo 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;
                    }
            
            Show
            ifernandezcalvo 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 ; }
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

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

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - I made a pull request with the change https://github.com/jenkinsci/jenkins/pull/2262
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Ivan Fernandez Calvo
            Path:
            core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
            http://jenkins-ci.org/commit/jenkins/37e7856b017fcf700d314086a709f00601edef00
            Log:
            JENKINS-34146 check if build is build able before to ask for parameters

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ivan Fernandez Calvo Path: core/src/main/java/jenkins/model/ParameterizedJobMixIn.java http://jenkins-ci.org/commit/jenkins/37e7856b017fcf700d314086a709f00601edef00 Log: JENKINS-34146 check if build is build able before to ask for parameters
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
            http://jenkins-ci.org/commit/jenkins/f6e431b80c4d162560419fa51633224a9724bb0d
            Log:
            Merge pull request #2262 from kuisathaverat/JENKINS-34146

            [FIX JENKINS-34146] check if build is build able before to ask for parameters

            Compare: https://github.com/jenkinsci/jenkins/compare/ce9de5a19dce...f6e431b80c4d

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/ParameterizedJobMixIn.java http://jenkins-ci.org/commit/jenkins/f6e431b80c4d162560419fa51633224a9724bb0d Log: Merge pull request #2262 from kuisathaverat/ JENKINS-34146 [FIX JENKINS-34146] check if build is build able before to ask for parameters Compare: https://github.com/jenkinsci/jenkins/compare/ce9de5a19dce...f6e431b80c4d

              People

              • Assignee:
                ifernandezcalvo Ivan Fernandez Calvo
                Reporter:
                ifernandezcalvo Ivan Fernandez Calvo
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: