This seems to be still happening: job-dsl 1.58
- Create test pipeline job named 'test' pointed to repo to read Jenkinsfile
Repo with the following Jenkinsfile
node {
jobDsl scriptText: 'job("example-2")'
jobDsl scriptText: """
def project = 'Netflix/asgard'
def branchApi = new URL(\"https:)
def branches = new groovy.json.JsonSlurper().parse(branchApi.newReader())
branches.each {
def branchName = it.name
def jobName = \"\${project}-\${branchName}\".replaceAll('/','-')
job(jobName) {
scm {
git(\"https:, branchName)
}
}
}
"""
jobDsl scriptText: """
folder('shared') {
displayName('Shared Jobs')
description('Shared Jobs Folder')
}
"""
jobDsl targets: ['jobs/*.groovy'].join('\n'),
removedJobAction: 'DELETE',
removedViewAction: 'DELETE',
lookupStrategy: 'SEED_JOB'
}
Repo has a jobs subfolder with any groovy scripts...
workspace for test is empty
workspace of test@script has the checked out repo
jenkins@50eeb9a40763:~/workspace$ ls -la *
test:
total 8
drwxr-xr-x 2 jenkins jenkins 4096 Mar 1 18:03 .
drwxr-xr-x 4 jenkins jenkins 4096 Mar 1 18:03 ..
test@script:
total 20
drwxr-xr-x 4 jenkins jenkins 4096 Mar 1 18:19 .
drwxr-xr-x 4 jenkins jenkins 4096 Mar 1 18:03 ..
drwxr-xr-x 8 jenkins jenkins 4096 Mar 1 18:19 .git
-rw-r--r-- 1 jenkins jenkins 835 Mar 1 18:19 Jenkinsfile
drwxr-xr-x 2 jenkins jenkins 4096 Mar 1 18:03 jobs
test job runs and fails at last step:
ERROR: no Job DSL script(s) found at jobs/*.groovy
https://github.com/jenkinsci/job-dsl-plugin/pull/862
Will be released in 1.48.