#2 Create task for rpmgrill
Closed: Fixed None Opened 9 years ago by lbrabec.

To use [[ https://git.fedorahosted.org/git/rpmgrill.git | rpmgrill ]] in taskotron, task formula and python directive to call the util need to be written.

Here is quick draft of formula and python code, it works somehow but needs more work especially how to get result and summary from rpmgrill output.

name: rpmgrill
desc: download specified koji build and run rpmgrill on it
maintainer: lbrabec

input:
    args:
        - koji_build

environment:
    rpm:
        - rpmgrill
        - libtaskbot

actions:
    - name: download build and run rpmgrill
      python:
          file: run_rpmgrill.py
          callable: run
          workdir: ${workdir}
          koji_build: ${koji_build}
      export: rpmgrill_output

    - name: report results to resultsdb
      resultsdb:
          results: ${rpmgrill_output}
import subprocess as sub
import os
from libtaskotron import check
import sys


def run(koji_build, workdir = u'.'):
    result = None

    workdir = os.path.join(workdir, koji_build)

    p = sub.Popen(['rpmgrill-fetch-build', koji_build, os.path.abspath(workdir)],
                   stdout=sub.PIPE,stderr=sub.PIPE)
    output, errors = p.communicate()

    sys.stderr.write("STDOUT: %s" % output)
    sys.stderr.write("STDERR: %s" % errors)

    p = sub.Popen(['rpmgrill', os.path.abspath(workdir)],
                   stdout=sub.PIPE,stderr=sub.PIPE)
    output, errors = p.communicate()

    sys.stderr.write("STDOUT: %s" % output)
    sys.stderr.write("STDERR: %s" % errors)

    output = open(os.path.join(workdir, "rpmgrill.yaml")).read()

    result = "PASSED" #TODO...

    summary = 'rpmgrill %s on %s' % (result, koji_build)
    detail = check.CheckDetail(koji_build, check.ReportType.KOJI_BUILD,
                                result, summary, [output])

    tapdetail = check.export_TAP(detail)
    return tapdetail


if __name__ == '__main__':
    tapout = run(sys.argv[1], sys.argv[2])

    print tapout

This ticket had assigned some Differential requests:
D907

We've actually had a repo for this for a while - sorry for missing this task for some reason.

https://bitbucket.org/fedoraqa/task-rpmgrill

As a progress report, rpmgrill developers are working on putting it into shape for Fedora needs. Once that happens, we might need to help them with Taskotron integration.

@ralph contacted us today and pointed us to https://github.com/default-to-open , which seems to contain about 8 months old rpmgrill. I'm not sure if it's the latest version, and whether we should start creating & maintaining task-rpmgrill, or some of them will want to. Ralph said he will get back to us with more details.

Login to comment on this ticket.

Metadata