-
Type:
Improvement
-
Resolution: Not A Defect
-
Priority:
Minor
-
Component/s: job-dsl-plugin
-
Environment: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.