Skip to content

redhat-developer/devspaces-jiralint

 
 

Repository files navigation

This repo contains utilities that use Jenkins for early warnings/error detection in jiras and other jira tools.

Contents of this repository

  • jiralint.py: takes a report.json to render jira query results into junit.xml test reports, and optionally send emails to component owners

  • read_filters.py, setup_filters.py, update_filters_permissions.py - tools to manage filters

  • constants.json: JIRA version configuration

  • *.json: filters and reports used to detect stale/non-triaged/incorrect jiras

Using jiralint

  1. Create a reports-<name>.json file with the following format (see examples in reports-daily.json and reports-weekly.json):

    [
      {
        "nofixversion": {
      "jql": "project = CRW AND fixVersion is EMPTY AND createdDate <= -7d",
            "description": "Issues have no fix version and was created 7 more than days ago - please triage."
        }
      },
      {
        "nocomponent": {
          "jql": "project in (CRW) AND component is EMPTY AND resolution is EMPTY",
          "description": "Issue has no component - please triage."
        }
      }
    ]

    Each entry has a report name used for identifying its results and then a jql for the query and finally a description which is added to each jira "error" message.

  2. Test it by running with --debug or -v and --dryrun or -d:

    $ python jiralint.py -u jirauser -k jiratoken -r reports-<name>.json -l <max num of issues>

    For each report, a *-test.xml file will be created containing test failures for each jira matching the queries.

  3. To send email for the failures, use these flags:

      -f, --fromemail             email address from which to send mail; if omitted, no mail will be sent
      -t, --toemail               email address override to which to send all mail; if omitted, send to assignees
      -m, --smtphost              smtp host to use; required if fromemail is specified
      -n, --unassignedjiraemail   email to use for unassigned JIRAs; required if fromemail is specified

    If sending mail, a .log file will be created for each *-test.xml.

  4. A Jenkins job is available to check jira daily:

Updating filters

To add a completely new filter requires a manual step, as jira does not currently support looking up filters by name (only by id).

When a new filter is added you have to do the following:

  1. Add it without an 'id' to the .json file

  2. Run the script, ie. python setup_filters.py -u jiralint -p secret -f filters.json,filters-composite.json

  3. Commit changes to .json files with updated filters

About

JIRA utilities used in Jenkins jobs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%