def main():
    ##### Check Body #####
    global result
    jenkins = connectToJenkins(url=url , passwd=passwd , user=user) #connect to jenkins

    for job in jobs:
        try:
            info = jenkins.get_job_info(job,depth=0,fetch_all_builds=False) #get the info of the job (last 100 builds)
        except Exception as e:
            print "Unable to fetch builds from job: " + job
            print e
            sys.exit(3)
        counter=0
        for build in info['builds']:
            if (counter>limit):
                break
            counter+=1
            number = build['number']
            try:
                buildInfo = jenkins.get_build_info(job , number ,depth=0) #get build information for each fetched build
            except Exception as exp:
                print "Unable to get build information from Job: " + job + ", Job Number: " + number
                print exp
                sys.exit(3)
            buildTime=epochToSeconds( time=buildInfo['timestamp'] ) #build time in Seconds
            currentTime = time.time() #the current time
            timeDiff = currentTime - buildTime
            if ( buildInfo['result'] == "FAILURE" and timeDiff < checkTime ): #need to document it if clauses are true
                result = result + "Failed Jenkins Job ID: " + buildInfo['id'] + ", INFO: " + buildInfo['fullDisplayName'] + "\n"
        output()
Exemplo n.º 2
0
        <td colspan="4" align="center"><a href="https://docs.google.com/spreadsheets/d/1V75IDtU8GWH2sX5G0dKQDH6K2RX5RZaoJQX0MoIEW4g/edit#gid=0"><b>Builds Reservation Sheet</b></a></td>
    </tr>
    <tr>
      <th>Build number</th>
      <th>Who triggered it?</th>
      <th>What's it for?</th>
      <th>How many minutes has it been running for?</th>
      <th>How much has it cost us so far?</th>
      <th>Terminate</th>
    </tr>
  </thead>
  <tbody>''')

for job in jobs:
    p('Getting info for job %s' % (job,))
    build = jenkins.get_build_info(job_builds[job.split('-')[-2]], int(job.split('-')[-1]))
    params = dict([(x['name'], x['value']) for x in build['actions'][0]['parameters']])
    running_for = (now-(build['timestamp']/1000))/60
    if "undercloud" in job:
        job_name = "undercloud-"
    else:
        job_name = ""
    if "overcloud" in job:
        job_id_del = job
    else:
        job_id_del = job.split('-')[-1]
    fp.write('''
    <tr>
      <td><a href="%s">%s</a></td>
      <td>%s</td>
      <td>%s</td>
Exemplo n.º 3
0
        <td colspan="4" align="center"><a href="https://docs.google.com/spreadsheets/d/1V75IDtU8GWH2sX5G0dKQDH6K2RX5RZaoJQX0MoIEW4g/edit#gid=0"><b>Builds Reservation Sheet</b></a></td>
    </tr>
    <tr>
      <th>Build number</th>
      <th>Who triggered it?</th>
      <th>What's it for?</th>
      <th>How many minutes has it been running for?</th>
      <th>How much has it cost us so far?</th>
      <th>Terminate</th>
    </tr>
  </thead>
  <tbody>''')

for job in jobs:
    p('Getting info for job %s' % (job, ))
    build = jenkins.get_build_info(job_builds[job.split('-')[-2]],
                                   int(job.split('-')[-1]))
    params = dict([(x['name'], x['value'])
                   for x in build['actions'][0]['parameters']])
    running_for = (now - (build['timestamp'] / 1000)) / 60
    if "undercloud" in job:
        job_name = "undercloud-"
    else:
        job_name = ""
    if "overcloud" in job:
        job_id_del = job
    else:
        job_id_del = job.split('-')[-1]
    fp.write('''
    <tr>
      <td><a href="%s">%s</a></td>
      <td>%s</td>
Exemplo n.º 4
0
<table>
  <thead>
    <tr>
      <th>Build number</th>
      <th>Who triggered it?</th>
      <th>What's it for?</th>
      <th>How many minutes has it been running for?</th>
      <th>How much has it cost us so far?</th>
      <th>Terminate</th>
    </tr>
  </thead>
  <tbody>''')

for job in jobs:
    p('Getting info for job %s' % (job,))
    build = jenkins.get_build_info('puppet-rjil-gate', job)
    params = dict([(x['name'], x['value']) for x in build['actions'][0]['parameters']])
    running_for = (now-(build['timestamp']/1000))/60
    fp.write('''
    <tr>
      <td><a href="%s">%s</a></td>
      <td>%s</td>
      <td>%s</td>
      <td>%s</td>
      <td>$%.2f</td>
      <td><a href="http://jiocloud.rustedhalo.com:8080/job/puppet-rjil-gate-delete/buildWithParameters?jobid=%s">Terminate</a></td>
    </tr>
''' % (build['url'], job, params['ghprbTriggerAuthor'], build['description'], running_for, (running_for/60)*1.17, job))

fp.write('''
  </tbody>