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

Missing DSL orphanedItemStrategy

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • job-dsl-plugin
    • Jenkins 2.92, bitbucket-branch 2.2.7, cloudbees-folder 6.2.1, job-dsl 1.66

      While trying the implement DSL configuration using Bitbucket Branch, I'm not able to implement orphanedItemStrategy. It defaults to a DefaultOrphanedItemStrategyContext, that do not exist on DSL API.

      Error:

      ERROR: (script, line 12) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.DefaultOrphanedItemStrategyContext.daysToKeep() is applicable for argument types: (java.lang.String) values: [10]
      Possible solutions: daysToKeep(int), getDaysToKeep(), setDaysToKeep(int), numToKeep(int)
      

      Looking into a manually configured Bitbucket Branch based build config.xml file, it shows that orphanedItemStrategy is implemented by cloudbees-folder.

      <orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.2.1">
          <pruneDeadBranches>false</pruneDeadBranches>
          <daysToKeep>-1</daysToKeep>
          <numToKeep>-1</numToKeep>
        </orphanedItemStrategy>
      

      Bitbucket Branch implements OrganizationFolder and expanding orphanedItemStrategy, does not show the same configurations as in the xml file.

      Test DSL script:

      organizationFolder('My DSL Folder test'){
          displayName('my_display_name')
          description('my_description')
          orphanedItemStrategy {
              discardOldItems {
                  daysToKeep('10')
                  numToKeep('10')
              }
          }
          organizations {
              bitbucket {
                  repoOwner('my_repo_code')
                  credentialsId('my_cred_id')
                  serverUrl('my_server_url')
              }
          }
      }
      

      To me, this seems a case of missing DSL configuration but not sure by which component.

            daspilker Daniel Spilker
            ncosta Nuno Costa
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: