Basically this version has the same features as the plugin for Jira Server (see below) but allows to run it as a Ruby script
Unzip the file
Install last version of Ruby in your system . Example on MacOs:
brew install ruby-install ruby-install --latest brew install ruby-3.2.1 brew install ruby@3.1 echo 'export PATH="/usr/local/opt/ruby@3.1/bin:$PATH"' >> ~/.profile ruby -v |
Install jira-ruby gem
cd jira-ruby-master sudo gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/ bundle install sudo gem install jira-ruby |
ruby rql2.rb --help Usage: rql.rb options -j JQL Jira jql code to retrieve issues - REQUIRED -f fields field list for jql -x expand expand list (all,project,issuetype,users,components,versions,comment,issuelinks,worklog,attachment,subtasks,customs) -q rql Improvekit ruby query language (rql) code to process jql result -F include extra (calculated) fields -n integer number of fields to generate for collection values fields (defaults apply) -N integer max number of rows to query -s fileName name of rql script file -d dirName full path name of scripts (by default current dir) -h host Jira host name -u user Jira user name -p passw Jira user password -c clear caches -T trial (for testing) -v verbose --help Ruby Query Language commands: select :all :fieldI, ... lambdaI | :field1 | lambda1 => :alias1, ... , fieldN | lambdaN => aliasN where field | lambda or where field | lambda => value Examples: where :createdYesterday or where :created => Date.yesterday or where lambda { |r| r.before? :created, Date.today } sort_by | order_by :field1, ... , fieldN [descending = false] group_by :field1 => :alias1, ... , fieldN => aliasN | lambdaN => :aliasN Example: data.group_by :project => :prj, lambda { |group| group.size} => :count where_ranked field, rankedByField, number Example: data.where_ranked :type, :items, 5 omit_all | omit field distinct field values_of field result set protocol: join set [fields = nil]. Example: activities.join group, [:project, :period, :type]. result.join set, indexed_on set indexed_on field. Example: index = data.indexed_on: [:project, lambda {:row | row quarterly}, :type ] exists? another_set num field statistics: sum, average, accum_sum, accum_average, max, min, median, mode, variance, standard_deviation buckets, centiles, quartiles, ranks row protocol: join row, in field, values, accum_sum field, scalar is_null? field, is_nothing? field, is_zero? num_field, is_today? date_field equal_to? field, after? field,value, before? field, value, between field,value |
ruby rql2.rb -h JIRA_URL -u your_username -p your_password -j "project=PROYECTNAME and created >=-90d" -srql_example.rb |
Result are answered in json format
This plugin allows you to obtain information from the Jira through queries written in a specific domain language called (RQL). The language is based on Ruby, with semantics similar to the well-known SQL to facilitate learning. The plugin is used as one more service available within your Jira server, from your own scripts and / or applications.
If you need support on the plugin, please send an email to improvekit@gmail.com and your order will receive a response and solution. Improvekit is formed by specialists in systems with more than 20 years of experience in software engineering and in Jira's employment every day and develops its applications following a mature methodology to provide its clients with the highest quality and service
Integrated with JQL
Domain Specific Language (RQL)
Caching of queries
Control over the fields and expansion of objects (such as projects, components, versions, comments)
Control over collection fields, selected in individual columns by value (you can indicate up to how many columns)
Limit the number of records returned
Supports custom fields
Supports script files
jira-server-url/plugins/servlet/rql
REST/json
POST
$ curl -uuser:passw http://jira-url/plugins/servlet/rql/license |
Send as request parameters
Parameter | Argument | Description |
---|---|---|
clear | Reset the plugin and clear caches. The clear command does not need to have established the session with login | |
expand | list of objects/attributes to expand | Answer additional expanded object attributes. Available expands includes:
|
extras | Also answer a set of predefined calculated fields and expands:
| |
fields | field names list | Also retrieve these fields from Jira. For all fields, specify *all |
filename | script_file_name | The filename that contains RQL query code |
jql | jql code | Main query to obtain data from Jira. Allways given, except for clear and verbose commands. Query results are cached (see also clear command) |
login | Set credentials with Jira (use cookies) | |
number_of_fields | number | For collection fields, max number of columns to answer with each value (defaults apply) |
rows_limit | number | Max number of rows to retrieve with JQL |
rql | rql code | Optional. This domain specific language query is processed over the data obtained with jql. See below for a language sintax and available commands |
scripts_dir | full-path-to-my-scripts-on-server | By default, jira-home/scripts/rql. See also filename |
verbose | Record process steps and information in Jira log (including Jira available field names) |
The JQL result data is available in a ResultSet class variable called data. Ruby syntax apply.
select :all | :field, ... lambdaI | :field1 | lambda1 => :alias1, ... , fieldN | lambdaN => aliasN
where field | lambda or where field | lambda => value
Examples:
data.where :createdYesterday or where :created => Date.yesterday or where lambda { |r| r.before? :created, Date.today } |
sort_by | order_by :field1, ... , fieldN [descending = false]
group_by :field1 => :alias1, ... , fieldN => aliasN | lambdaN => :aliasN
data.group_by :project => :prj, lambda { |group| group.size} => :count |
where_ranked field, rankedByField, number
data.where_ranked :type, :items, 5 |
omit_all | omit field
distinct field
values_of field
join set [fields = nil].
activities.join group, [:project, :period, :type] result.join set, indexed_on set |
indexed_on field.
index = data.indexed_on: [:project, lambda {:row | row quarterly}, :type ] |
exists? another_set
sum, average, accum_sum, accum_average, max, min, median, mode, variance, standard_deviation, buckets, centiles, quartiles, ranks
join row
in field, values
accum_sum field
scalar
is_null? field
is_nothing? field
is_zero? num_field
is_today? date_field
equal_to? field
after? field, value
before? field, value
between field,value
Below are a series of service requests to the plugin using the command line (curl)
curl -uuser:passw -X POST http://jira-url/plugins/servlet/rql?clear=yes |
The value of the clear parameter could be any value, if the clear parameter is provided the plugin is assumed as yes
curl -uuser:passw -X POST http://jira-url/plugins/servlet/rql?"clear=-c&verbose=-v" |
curl -uuser:passw -X POST http://jira-url/plugins/servlet/rql?login -c session |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "\ verbose=-v& \ jql=project=RQL& \ rql=data.distinct :project" |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "verbose=yes&jql=project=RQL&fields=components,fixVersions" |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "verbose=-v&\ jql=project=RQL&\ rql=data.where :resolution => 'Done'" |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "verbose=yes&\ jql=project=RQL&\ fields=issuetype,project&\ extras=-yes&\ expand=versions,components,issuelinks&\ rql=data.where lambda { |row| row.before? :worklogs1_started, Date.new }" |
curl -X POST http://jira-url/pluginsservlet/rql -b session -d "verbose=-v&\ jql=project=RQL&\ fields=issuetype,project&\ expand=versions&\ rql=data.group_by :project => :p, :versions1_name => :v,\ lambda {|group| (group.distinct :issuetype).values.join('~')} => :instruments,\ lambda {|group| group.size} => :items" |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "verbose=-v&jql=project=RQL&password=passw&rql=\ ((data.group_by :project => :project, :issuetype => :type, lambda {|r| r.size } => :value)\ .where_ranked :type, :value, 5)\ .transposed_sum :type" |
curl -X POST http://jira-url/plugins/servlet/rql -b session -d "jql=project=RQL&filename=rql_example.rb" |
rql_example.rb:
activities = (ranks = ((data.group_by :project, :issuetype, lambda {|r| Date.parse(r.created).quarter} => :quarter) .select :project, :issuetype, :quarter, lambda {|group| group.size} => :items) .where_ranked :issuetype, :items, 5).indexed_on [:project, :quarter, :issuetype] periods = data.group_by :project, :issuetype, lambda {|row| Date.parse(row.created).quarter} => :period rows = (periods.group_by :project, :issuetype => :type, :period => :period, lambda {|group| group.size} => :total) .select :project, :period, :type, lambda {|group| row = activities.join group, [:project, :period, :type] row.items unless row.nil? } => :items, :total => :total |
If you need support on the plugin, please send an email to improvekit@gmail.com and your order will receive a response and solution. Improvekit is formed by specialists in systems with more than 20 years of experience in software engineering and in Jira's employment every day and develops its applications following a mature methodology to provide its clients with the highest quality and services.