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

Add closest modifiable ancestor LookupStrategy

    Details

    • Similar Issues:

      Description

      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.)

        Attachments

          Activity

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

          Frédéric Chuong Can you test if this approach would work for you?

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

          Show
          daspilker 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. Frédéric Chuong Can you test if this approach would work for you? https://github.com/jenkinsci/job-dsl-plugin/pull/1001
          Hide
          scm_issue_link 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]

          Show
          scm_issue_link 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]
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: