Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put jobs inside a folder in jenkins?

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 !!

like image 647
Ibtissam Avatar asked Apr 13 '17 08:04

Ibtissam


People also ask

How do I add jobs inside a folder in Jenkins?

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.

Where is the jobs folder in Jenkins?

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/ .

What is the use of folder in Jenkins?

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.

How do I move jobs to view in Jenkins?

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.


1 Answers

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
}
like image 176
Suresh Avatar answered Oct 18 '22 20:10

Suresh