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

Unable to change from "Build with parameters" to "Build Now"

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      How to reproduce:

      1. Configure Multibranch project with jenkinsfile and a pom.xml that should contain a version block. First build should run sucessfull.
      2. Comment jenkins properties code block and commit changes.
      3. Manual trigger "Scan Branch Pipeline Now"
      4. "Build with Parameters" still present on left menu. "Build Now" should appear instead.

      Jenkinsfile:
       

      node('master'){
      checkout scm
      
      // Read POM
      def pomModel = readMavenPom file: 'pom.xml'
      def pomVersion = pomModel.version
      
      properties([parameters([string(defaultValue: "${pomVersion}", description: 'Stage Information', name: 'versioninfo'),
      string(defaultValue: 'My 1st Default Stage information', description: 'Stage Information', name: 'firststageinfo'),
      string(defaultValue: 'My 2nd Default Stage information', description: 'Stage Information', name: 'secondstageinfo'),
      string(defaultValue: 'My 3rd Default Stage information', description: 'Stage Information', name: 'thirdstageinfo')]),
      pipelineTriggers([])])
      
      echo pomVersion
      echo params.firststageinfo
      echo params.thirdstageinfo
      }
      

       
      pom.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
      
          <groupId>com.example</groupId>
          <artifactId>artifact-example</artifactId>
          <version>0.0.1-SNAPSHOT</version>
      
      </project>
      

        Attachments

          Activity

          Hide
          ncosta Nuno Costa added a comment -

          The only way I found to workaround this, was to create a new branch with a different name.

          Jenkins detects the new branch and Build Now is shown.

          Show
          ncosta Nuno Costa added a comment - The only way I found to workaround this, was to create a new branch with a different name. Jenkins detects the new branch and Build Now is shown.
          Hide
          ncosta Nuno Costa added a comment -

          Another way to workaround without changing branch is manually comment this code block, in the affected project config.xml file:

          <hudson.model.ParametersDefinitionProperty>
          ...
          </hudson.model.ParametersDefinitionProperty>

          and restart jenkins service.

          Show
          ncosta Nuno Costa added a comment - Another way to workaround without changing branch is manually comment this code block, in the affected project config.xml file: <hudson.model.ParametersDefinitionProperty> ... </hudson.model.ParametersDefinitionProperty> and restart jenkins service.
          Hide
          hvdbrand Hugo van den Brand added a comment -

          I am experiencing the same problem.

          Is there any way via the pipeline file to remove the parameters?

          Otherwise I consider it a bug in the parameters implementation:

          If no items are in the parameter list it should not create a
          ParametersDefinitionProperty

          Show
          hvdbrand Hugo van den Brand added a comment - I am experiencing the same problem. Is there any way via the pipeline file to remove the parameters? Otherwise I consider it a bug in the parameters implementation: If no items are in the parameter list it should not create a ParametersDefinitionProperty

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ncosta Nuno Costa
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: