Streamlining JIRA Instance: How to Extract Commercial Add-Ons

Introduction

Today I had to update a zillion licenses of commercial add-ons in different instances. As being a lazy consultant who likes to use a command line instead of a mouse, I decided to check if I could use the UPM REST API to extract the information.

Ingredients for this recipe are a computer capable of running unix commands, curl (which is pretty standard on most unix distributions), and jq

Script :

#!/bin/bash
 
####
# extractUserAddons.sh <baseurl> <userid> <passwd>
#
BASEURL=$1
USERID=$2
PASSWD=$3
 
  
#
# use curl to retrieve all the addons from the UPM on the JIRA
# use jq to select only the addons which have properties .userInstalled and .usesLicensing
# for each result, access the UPM again to retrieve the license information
# and retrieve information using jq
#
curl -s --user $USERID:$PASSWD $BASEURL/rest/plugins/1.0/ | jq -r '.plugins | map(select(.userInstalled)) | map(select(.usesLicensing)) | .[] | (.key) ' |
while read -r line ; do
    curl -s --user $USERID:$PASSWD $BASEURL/rest/plugins/1.0/$line-key/license | jq -r '"(.pluginKey):(.contactEmail):(.supportEntitlementNumber):(.evaluation):(.maintenanceExpiryDateString)"'
done

How to use :

1. Create the script.

2. Execute the script.  Note that you need to use an account with administrator access.

sh extractUserLicense.sh https://jira.acme.com francis mysecret

 

Are you still using multiple-issue trackers?
Check out Exalate – It’s an advanced issue synchronization solution that supports cross-organization issue tracking.
Its flexibility comes from the built-in groovy scripting capability, allowing it to implement almost any type of integration.

We hope this script will simplify your use of the tool. If you need any support, please contact us.

Outline

Subscribe to our newsletter to receive Idalko’s insights & events

    Related Articles