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

Add closest modifiable ancestor LookupStrategy

      Given the following item hierarchy:

      • Jenkins root
        • ModifiableFolder (such as com.cloudbees.hudson.plugins.folder.Folder)
          • ComputedFolder (such as org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject)
            • JobDslAwareJob (such as org.jenkinsci.plugins.workflow.job.WorkflowJob with Jenkinsfile making use of the jobDsl pipeline DSL)

      Without prior knowledge of ModifiableFolder, it is not possible to create a job under that folder:

      • with JENKINS_ROOT lookup strategy
      • with SEED_JOB lookup strategy as it will attempt to create under ComputedFolder which does not implement ModifiableTopLevelItemGroup

      A "closest modifiable ancestor" strategy would help creating jobs within ModifiableFolder regardless of its characteristics (name, subfolder, etc.)

          [JENKINS-40732] Add closest modifiable ancestor LookupStrategy

          I opened a pull request to allow .. segments in paths. So you can do job('../../example') to go back to any parent if using the SEED_JOB lookup strategy. I think this approach is more flexible than adding a new lookup strategy.

          fchuong Can you test if this approach would work for you?

          https://github.com/jenkinsci/job-dsl-plugin/pull/1001

          Daniel Spilker added a comment - I opened a pull request to allow .. segments in paths. So you can do job('../../example') to go back to any parent if using the SEED_JOB lookup strategy. I think this approach is more flexible than adding a new lookup strategy. fchuong Can you test if this approach would work for you? https://github.com/jenkinsci/job-dsl-plugin/pull/1001

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/LookupStrategy.java
          job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/LookupStrategySpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/25ed646b581eeda90bebdb61ed76a654704ef825
          Log:
          allow .. path segments in job, folder and view names

          [FIXES JENKINS-40732]

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/LookupStrategy.java job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/LookupStrategySpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/25ed646b581eeda90bebdb61ed76a654704ef825 Log: allow .. path segments in job, folder and view names [FIXES JENKINS-40732]

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/LookupStrategy.java
          job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/LookupStrategySpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/2a79801aa1c26910a796eb02a0fcb56f2cb02159
          Log:
          Merge pull request #1001 from daspilker/JENKINS-40732

          JENKINS-40732 allow .. path segments in job, folder and view names

          Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/8569f5e0ffc7...2a79801aa1c2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/LookupStrategy.java job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/LookupStrategySpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/2a79801aa1c26910a796eb02a0fcb56f2cb02159 Log: Merge pull request #1001 from daspilker/ JENKINS-40732 JENKINS-40732 allow .. path segments in job, folder and view names Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/8569f5e0ffc7...2a79801aa1c2

            daspilker Daniel Spilker
            fchuong Frédéric Chuong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: