Search code examples
pythonjenkinsdirectory

How to work with folders in python-jenkins


I am trying simply to list all jobs under a folder (not view) with the python-jenkins package.

I have a structure, say, https://jenkins.xxx.com/job/lvl1/job/lvl2/job/lvl3/..

  1. how can I create a new folder at a specific location, e.g. parallel to lvl2?
  2. how can I list all jobs under a specific folder, say lvl3?

How the folder entity is presented in the python-jenkins package?


Solution

  • The answer to this is to separate the jobs with a slash. So, if the path in Jenkins is: parent/job/child1/job/child2, you would use server.get_job_info('parent/child1/child2') and the library will convert this to the proper path.