usage: jipdate.py [-h] [-q] [-e] [-f FILE] [-t] [-u USER] [-v] [-x] [--all]
Script used to update comments in Jira
optional arguments:
-h, --help show this help message and exit
-q Query Jira for issue(s) assigned to you
-e Only include epics (no initiatives or stories). Used
in combination with "-q"
-f FILE, --file FILE Load status update from FILE. NOTE: -q will overwrite
the content of FILE
-t Use the test server
-u USER, --user USER Query Jira with another Jira username (first.last or
[email protected])
-v Output some verbose debugging info
-x EXCLUDE stories from gathered Jira issues. Used in
combination with "-q"
--all Load all Jira issues, not just the once marked in
progress.
$ git clone https://github.com/Linaro/jipdate.git
alternatively download it directly to a folder in your $PATH
, for example:
$ cd $HOME/bin
$ wget https://raw.githubusercontent.com/Linaro/jipdate/master/jipdate.py
$ sudo pip install jira
Note On recent MAC OS X you may have to run
$ sudo pip install --user --upgrade jira
In case you have both Python 2 and Python 3 installed at the same machine you
will eventually need to run with pip2
instead.
$ sudo pip2 install jira
Note, the script relies on running Python 2, and not Python 3. If you are
using Arch Linux you may have to manually tweak the script to execute
/usr/bin/env python2
instead.
The script by default uses the official Linaro Jira server. If you intend to
play around with the script just for testing purposes, then you should use
the -t
argument, which will make the script use the Linaro test Jira
server instead.
A status file could be seen as a simple text file containing a header which could be written as a normal email. This is then followed by one or more issue/comment sections. The idea is that you should be able to use the same file regardless if you are just updating Jira or if you want to send it as a status update to your team via email for example.
An example of a status update file (generated by the script itself) could look like this:
Hi,
This is the status update from me for the last week.
Cheers!
Joakim Bech
[SWG-23]
# Header: Kernel Hardening
# Type: Initiative
# Status: In Progress
No updates since last week.
[SWG-18]
# Header: GlobalPlatform adaptations
# Type: Initiative
# Status: In Progress
No updates since last week.
[SWG-1]
# Header: TEE/TrustZone: Open Source Trusted OS
# Type: Initiative
# Status: In Progress
Maintenance still ongoing.
The parsing rules are rather simple.
- A line containing only
[ISSUE-123]
marks the start for a new issue. Everything after that will be considered as a comment belonging to that particular issue until it finds another empty line containing just[ISSUE-124]
(since that marks the start for another new comment to another issue). - Lines starting with
#
are editor comments and will not be included in the actual update message (i.e., the same way as git deals with comments in commit messages). - Everything before the first
[ISSUE-123]
in a status file will be ignored when updating Jira. Instead that will typically be used to write additional information complementing the status update when re-using the status file to send email about your status. - It is possible to refer to other issues in a comment as long as it is not
standalone on a single line, i.e., in a comment section it is fine to write that
"This depends on
[ISSUE-111]
".
With command line parameters, there several ways to run the script. But the three most common cases are listed here below (section 2-4). Pick the one that suites your needs best, but first, start with exporting your credentials to the Jira server.
$ export JIRA_USERNAME="[email protected]"
$ export JIRA_PASSWORD="my-super-secret-password"
We know that this isn't best practice when it comes to security. In bash you can
play with HISTCONTROL
to make bash not save the information in the history
file. In many configurations it is sufficient to add a leading space before the
export command to make bash not save a command to history.
If you have no previous status file, then the easiest way to is to make the script create one for you, this is done by (generates a file similar to the one above in the previous section):
$ ./jipdate.py -q -f status.txt
or if want all of your open issues, then run:
$ ./jipdate.py -q --all -f status.txt
Note that when using the -f
parameter in combination with -q
will make
the script overwrite the current file. If you do not want to override the
file, then look at the next section(s).
If you do not want the script to override you status file then you should
not use the -q
parameter when running the script. An example when this could
be used is when you already have a file containing almost up-to-date information
and you only want to make minor modifications to it. I.e, it could be that you
re-use the same file week after week. So, in this case you simply run the script
by:
$ ./jipdate.py -f status.txt
As an alternative to working with a local file, you can simply call the script
without using the -f
parameter. In that case it will simply use the output
from the Jira query (in a temporary file). Here is how to do that:
$ ./jipdate.py -q
or if want all of your open issues, then run:
$ ./jipdate.py -q --all
- Works on Python2 only (probably an easy fix, raw_input / input must be fixed).