#284 Show build link(s) on buildContainer task page
Merged 4 years ago by tkopecek. Opened 7 years ago by tkopecek.

file modified
+7 -2
@@ -666,15 +666,20 @@ 

      elif task['method'] == 'restartVerify':

          values['rtask'] = server.getTaskInfo(params[0], request=True)

  

+     values['taskBuilds'] = []

      if task['state'] in (koji.TASK_STATES['CLOSED'], koji.TASK_STATES['FAILED']):

          try:

              result = server.getTaskResult(task['id'])

-             values['result'] = result

-             values['excClass'] = None

          except:

              excClass, exc = sys.exc_info()[:2]

              values['result'] = exc

              values['excClass'] = excClass

+         if not values.get('result'):

+             values['result'] = result

+             values['excClass'] = None

+             if task['method'] == 'buildContainer' and 'koji_builds' in result:

+                 values['taskBuilds'] = [

+                         server.getBuild(int(buildID)) for buildID in result['koji_builds']]

      else:

          values['result'] = None

          values['excClass'] = None

@@ -314,6 +314,13 @@ 

        <th>Build</th><td><a href="buildinfo?buildID=$taskBuild.build_id">$koji.buildLabel($taskBuild)</a></td>

      </tr>

      #end if

+     #if $taskBuilds

+     #for $build in $taskBuilds

+     <tr>

+       <th>Build</th><td><a href="buildinfo?buildID=$build.build_id">$koji.buildLabel($build)</a></td>

+     </tr>

+     #end for

+     #end if

      <tr>

        <th>Created</th><td>$util.formatTimeLong($task.create_time)</td>

      </tr>

Workaround before we have a proper web plugin API

Check results, possible try/except for KeyErrors.

rebased

7 years ago

rebased

6 years ago

rebased onto 63ddb06eaa3d8736b658b9abf9f11eb716570174

6 years ago

rebased onto 5c3485ea5fe2153e02fb2a934a3b4731acf5369c

4 years ago

When I try this with some real data, the section is missing and the Result shows a traceback from the web code rather than the actual (non-traceback) result.

GenericError: invalid format: 1011148

So there are two problems here. First the code should not show its own exception as a task result. To avoid this, we should pull everything but the call to server.getTaskResult out of the try.

Second, to be friendly to this plugin, we should probably handle the case the build id is an integer in string format. We might consider doing that in the getBuild call itself, but if not we could handle it here.

rebased onto f431e43

4 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

Commit ad61fde fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

4 years ago