I'm trying to put jobs inside a folder using jenkins DSL script Now i create a listView and i put inside my jobs here the code i'm using
listView('MyJobsList') {
jobs {
map.each{
name((it.key).trim())
}
}
columns{
status()
weather()
name()
lastSuccess()
lastFailure()
lastDuration()
buildButton()
}
}
i want to do the same thing but this time i want to put the jobs in a folder !!
Creating a job in a folderStep #1: From within the desired folder, click “New Item” to create a new item (job/folder). In this case we're using the “Finance” folder we created in the previous task. Step #2: Enter a name in the textbox and select “Freestyle project” and click “OK” to create the job.
From the File System In any case, you can find the item directory of a specific item in the file system under the Item Root Directory at $JENKINS_HOME/jobs/$PATH_TO_JOB/ .
A Jenkins plugin which allows users with config permission to define properties for a folder which can then be used by any jobs contained within it or any of its sub-folders. You can find this plugin's source code on Github.
1) Click on the view in which you want to add the newly created Job as shown in pic. 2) Click on Edit View on left side and then select the appropriate job under Job Filter using the check box. 3) Once you selected the required Job click on save button. This job will be now shown under the view.
Please refer the below Job-DSL documentation to create a folder in Jenkins through Job-DSL.
Folder
folder('folder-a') {
description('Folder containing all jobs for folder-a')
}
job('folder-a/job-a') {
// Job config goes here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With