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

(Sub)Folder and job not created with Job DSL "unknown parent path" in multibranch pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • Windows,

      I've got a multibranch-pipeline job, where trunk contains the following Jenkinsfile:

        

      pipeline {
          agent any
          triggers {
              pollSCM('H/2 * * * *')
          }
          stages {
              stage('Seed other jobs') {
                  steps {
                      jobDsl targets: ['jenkins/jobs.groovy'].join('\n'),
                              removedJobAction: 'DELETE',
                              removedViewAction: 'DELETE',
                              lookupStrategy: 'SEED_JOB',
                              sandbox: true
                  }
              }
          }
      }

       

      The Multibranch Job itself is in a folder called "Seed Jobs".

       

      jobs.groovy:

      folder("testnoslash")
      folder("/testwithslash")
      folder("/testwithslash/subfolder")
      

       

       

      However, testnoslash is not created at all. The "console output" doesn't inform anything about "testnoslash".

       

      testwithslash is created in as a top-level job, as expected. /testwithslash/subfolder, however, is again missing.

       

      The global log shows that "testnoslash" is does not seem to be supported inside multi branch pipline jobs:

      createOrUpdateConfig for testnoslash
      Mai 02, 2017 4:47:27 PM WARNING javaposse.jobdsl.plugin.JenkinsJobManagement createNewItem
      Could not create item within class org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject
      Mai 02, 2017 4:47:27 PM INFO javaposse.jobdsl.plugin.JenkinsJobManagement createOrUpdateConfig
      createOrUpdateConfig for /testwithslash
      Mai 02, 2017 4:47:27 PM INFO hudson.model.AllView migrateLegacyPrimaryAllViewLocalizedName
      JENKINS-38606 detected for AllView in job/testwithslash/; renaming view from All to all
      Mai 02, 2017 4:47:27 PM INFO javaposse.jobdsl.plugin.JenkinsJobManagement createOrUpdateConfig
      createOrUpdateConfig for /testwithslash/subfolder
      Mai 02, 2017 4:47:27 PM INFO org.jenkinsci.plugins.workflow.job.WorkflowRun finish
      Seed Jobs/FAK/trunk #19 completed: FAILURE

      I would expect this to abort the script with a meaningful error message!

      However, I get the following instead:

      /testwithslash works fine, but an output in the console would be nice. Then, the subfolder doesn't work at all. It fails with the message:

       
      ERROR: Could not create item, unknown parent path in "/testwithslash/subfolder"
       

      I don't understand why this would happen. This mirrors the example in the API documentation, except they don't use the leading slash, which seems to be required in my setup and works for "testwithslash", why not for "testwithslash/subfolder"? This appears to be a bug.

       

      Update: This also applies to jobs. Trying to create a pipelineJob, it succeeds without error without a slash, even though no job is actually created, with a slash, it creates a job as expected, trying to create it in a subfolder fails with "unknown parent" again, no matter whether there is a leading slash or not.

       

      Summary:

      • testwithnoslash, not created, no error message, does not abort the script
      • /testwithslash, fine
      • /testwithslash, does not work, error message doesn't make sense, should work IMHO, this is a bug
      • pipelineJob fails/works the exact same way as folder, probably applies to all items that can be created

            daspilker Daniel Spilker
            vqrs Christian V
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: