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

JobDSL API viewer unaware of properties/folderConfig for multibranchPipelineJob

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-dsl-plugin
    • None
    • Jenkins 2.346.2 standard docker image on Ubuntu 20.04, Job DSL plugin 1.81, Docker Pipeline plugin 1.29

      multibranchPipelineJob has a Properties section with the following fields:

      • Docker Label
      • Docker registry URL
      • Registry credentials

      I could not find anything relevant in the Job DSL API viewer on my Jenkins install. I looked at the config.xml and tried something, and it worked! Which means the API viewer is missing that information. Following is working for me and configuring those fields.

      multibranchPipelineJob('Foo-Build') {
          properties {
              folderConfig {
                  dockerLabel('Foo-Build-Docker')
                  registry {
                      url('https://harbor/')
                      credentialsId(null)
                  }
              }
          }
      }
      

      Please document folderConfig under properties.

          [JENKINS-69181] JobDSL API viewer unaware of properties/folderConfig for multibranchPipelineJob

          Pavel Roskin added a comment -

          I tried to make a fix on my own, but it's more complex than I expected. Here are my findings so far.

          FolderConfig.java was in pipeline-model-definition-plugin but was removed from it in JENKINS-58732.

          docker-workflow-plugin has FolderConfig.java now.

          "org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig" is a compatibility alias, the actual location is "org.jenkinsci.plugins.docker.workflow.declarative.FolderConfig"

          config.xml is using the above alias name.

          There is an example of using "configure" to achieve the same goal as my snippet: https://github.com/samrocketman/jervis/blob/main/jobs/jenkins_job_multibranch_pipeline.groovy#L70

          JobDSL has a special file for handling "properties", PropertiesContext.groovy. That's probably where the fix should go.

          Pavel Roskin added a comment - I tried to make a fix on my own, but it's more complex than I expected. Here are my findings so far. FolderConfig.java was in pipeline-model-definition-plugin but was removed from it in JENKINS-58732 . docker-workflow-plugin has FolderConfig.java now. "org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig" is a compatibility alias, the actual location is "org.jenkinsci.plugins.docker.workflow.declarative.FolderConfig" config.xml is using the above alias name. There is an example of using "configure" to achieve the same goal as my snippet: https://github.com/samrocketman/jervis/blob/main/jobs/jenkins_job_multibranch_pipeline.groovy#L70 JobDSL has a special file for handling "properties", PropertiesContext.groovy. That's probably where the fix should go.

            jamietanna Jamie Tanna
            proski Pavel Roskin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: