Jenkins CLI列表文件夹工作 [英] Jenkins CLI List-Jobs with folders
问题描述
使用Jenkins Folders插件时,是否有一种方法可以获取与默认CLI中的list-jobs工作方式类似的所有工作(包括文件夹中的工作以及可能的文件夹路径)的列表?
While using the Jenkins Folders Plugin, is there a way to get a list of all jobs (including jobs in folders and possible the folder path) simular to how list-jobs in the default CLI works?
我制作了一个小的PowerShell脚本,以获取默认仪表板中每个作业的最新版本的信息,并将相关信息导出到excel。但是现在我们开始使用文件夹了,它不适用于文件夹及其中的工作。
I have made a small PowerShell script to get info for the last build of every job in the default dashboard and export relevant info to excel. But now we started using folders, and it doesnt work for folders and the jobs in them.
我的旧导入代码:
java -jar jenkins-cli.jar -s http://localhost:8080 list-jobs --username $username --password $password > jobs.csv
http://pastebin.com/raw/rcj99rjx 查看带有注释的完整代码
http://pastebin.com/raw/rcj99rjx for my full code with comments
推荐答案
通过运行groovy脚本解决。
Solved it by running a groovy script.
import jenkins.model.*
import hudson.model.*
Jenkins.instance.getAllItems(AbstractProject.class).each { println(it.fullName) };
和此cli代码来调用脚本。
and this cli code to call for the script.
java -jar jenkins-cli.jar -s http://localhost:8080 groovy all_jobs.gsh --username $username --password $password > jobs.csv
这篇关于Jenkins CLI列表文件夹工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!