2017-07-25 2 views

答えて

0

ジェンキンスAPI:{JENKINS_URL}/job/{JOB_NAME}/api/json?tree=allBuilds[url,result,timestamp,name,description,actions]
これまでのところ、すべてのビルドを実行できます。そして、このJSONをJAVAまたは好みのコード言語を使って繰り返し、あなたのケースのタイムスタンプにある検索条件に一致させることができます。

0

Jenkinsスクリプトコンソールを使用できます。 たとえば、ビルドステップが定義されたビルドを示すコードです。

def findBuildContainStep(searchClass) { 
def jobs = jenkins.model.Jenkins.instance.getAllItems(AbstractProject.class).toArray() 
for(int j = 0 ; j < jobs.size(); j++) { 
    if (jobs[j].class == hudson.model.FreeStyleProject.class) { 
     def steps = jobs[j].getActions().toArray() 
     for(int s = 0 ; s < steps.size(); s++) { 
      if (steps[s].class == searchClass) { 
       println(jobs[j].getName()) 
      } 
     } 
     steps = jobs[j].getPublishers() 
     steps.each { 
     // somewhere here should be your condition 
      if (it.getValue().class == searchClass) { 
       println(jobs[j].getName()) 
      } 
     } 
    } 
    } 
} 
    findBuildContainStep(org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.class) 
関連する問題