I am trying to create a Jenkins Job inside a folder using Jenkins Job Builder, no luck so far ;(
The following creates the job and the folder, but the job is not inside the folder ;(
Please help
contents of rest-framework.yaml
- job:
name: folder_test
project-type: folder
primary-view: project_view
health-metrics:
- worst-child-health-metric
- view:
name: project_view
view-type: list
folder: true
columns:
- status
- weather
- job
- last-success
- last-failure
- last-duration
regex: (?!rest-framework.*).*
- job-template:
name: '{name}-hello-world'
builders:
- shell: 'echo "hello world!"'
- project:
name: rest-framework
jobs:
- '{name}-hello-world'
In order to place the job you created in a folder, make sure the name at the project level or the job level includes the folder.
Example:
- job-template:
name: '{name}-hello-world'
builders:
- shell: 'echo "hello world!"'
- project:
name: folder_test/rest-framework
jobs:
- '{name}-hello-world'
This snippet requires the folder to already be created (which you did above, but cut it off here for simplicity).
Edited: Removed original response saying it isn't possible, but I did more testing to find a solution using Jenkins-Jobs-Builder 2.0.0.