I'm trying to dynamically determine job names based on running a script from the workspace (checked out via git).
Pseudocode:
job_names = execute_command('./job-names.sh')
job_names.each { job_name ->
job(job_name) {
...job config...
}
}
Is this possible? I've tried a few different things with little success. In my case, I have a "make" command that generates this list, so I'm running:
workspace = hudson.model.Executor.currentExecutor().getCurrentWorkspace().toString()
job_names = "make -C ${workspace} job-list".execute().text.split("\n")
The "job_names" variable is showing up as an empty array, so my job fails to create any jobs.