Since Version 3.1

JQL Environment Functions

Environment Manager provides new functions you can use to write advanced JQL queries.

JQL is a powerful query language to perform search in JIRA. A good introduction to JQL can be found here : https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql



deployedVersions()

Return the versions that are deployed on existing environments.


Basic examples

fixVersion in deployedVersions()

-> will return all issues having a fixVersion deployed to an existing environment. Useful to know the list of bugs that can be verified on a live environment.

affectedVersion in deployedVersions() 

-> will return all issues having an “Affects Version/s:” deployed to an existing environment. Useful to know the list of bugs than can be reproduced on a live environment.


Advanced examples

fixVersion in deployedVersions(Staging,PreProd)

-> will return all issues having a fixVersion deployed to a Staging or PreProd environment. Useful to know the list of bugs for a customer acceptance testing campaign ?

fixVersion in deployedVersions(eCommerce,ERP)

-> will return all issues having a fixVersion deployed to an eCommerce or ERP environment.

fixVersion in deployedVersions(Staging,"Pre Production") and fixVersion in deployedVersions(eCommerce)

-> will return all issues having a fixVersion deployed to an eCommerce Staging or eCommerce Pre Production environment.


Examples using “status=…” expression

fixVersion in deployedVersions(Staging,PreProd,"status=Available")

-> will return all issues having a fixVersion deployed to a Staging or PreProd environment that have an “Available” status. Useful to know the list of bugs that can be tested on an “working” environment !

fixVersion in deployedVersions(Staging,PreProd,"status=Unavailable,EMPTY")

-> will return all issues having a fixVersion deployed to a Staging or PreProd environment that have an “Unavailable” or unknown status. Useful to get a list of bugs that cannot be tested because of non working or unstable environments.


deployedAndPreviousVersions()

since Version 3.8

Same as deployedVersions() but returns also the versions with a lower version number comparing to the deployed ones.

Imagine that you have the version 3.3 deployed on Staging, deployedAndPreviousVersions() will also return the versions 3.2, 2.0, 3.0.2, 1.0, 0.3,… (if they exist). It enables you to easily get the list of issues that can be tested, reproduced,… on your various environments.

Version Naming Convention

Since version 3.10 you can use almost any kind of naming conventions to order your versions. You can also mix numeric with alphanumerics to number your versions.

It allows you also to compare bananas with apples ! comparing versions with prefix used by different applications can lead to strange results.

Version naming conventions examples

  • 1.2.3
  • 1.2.3.b454
  • eCommerce 1.2.3
  • eCommerce_1.2.3
  • eCommerce-1.2.3
  • eCommerce 1.2.3.b343

Ordering rules examples

  • 1.2 > 1.1
  • 1.20 > 1.2
  • 1.001 == 1.1
  • 1.2.3.b454 > 1.2.3.a999
  • 1.2.3.b454 > 1.2.3.b452
  • 1.2.3.b454 > 1.2.3
  • APP_A_MOBILE 1.2 > APP_B_ERP 1.3 (example of “bananas with apples” comparison)

N.B. You can use exactly the same syntax and subfunctions as the deployedVersions() function.

Version comparison and ordering algorithm

The algorithm to compare and order versions names is simply extracting all chunks of numbers found in the version name. Then it concatenate all found numbers from left to right. The resulted concatenated numerical value is then used for comparison.

This algorithm is very flexible and does not depends on usage of specific separators between chunk of numbers. The chunks of numbers found in the left of your version number will always take precedence over the next chunks of number on the right

For java readers, you will find below example of comparisons with different format of version names:

 


public class VersionNameComparatorTest {

    private int compare(String versionName, String versionName2) {
	VersionNameComparator comparator = new VersionNameComparator(versionName);
	return comparator.compareTo(versionName2);
    }

    private void assertVersionEquals(String versionName, String versionName2) {
	assertEquals(0, compare(versionName, versionName2));
    }

    private void assertAscOrder(String beforeVersionName, String afterVersionName) {
	assertTrue(compare(beforeVersionName, afterVersionName) < 0);
    }

    @Test
    public void testEquals() {

	assertVersionEquals("1.0", "1.0");
	assertVersionEquals("1.0.0", "001.000.0000");
	assertVersionEquals("1.0.0b.0", "1.000.000b.0");
	assertVersionEquals("test 1", "tEsT 001");
	assertVersionEquals("test 10", "test 0010");
	
    }

    @Test
    public void testOrder() {
	assertAscOrder("1.0", "1.1");
	assertAscOrder("rrr1.0kjhkjh1", "test 1.1");

	assertVersionEquals("1.0", "1.0");
	assertAscOrder("kjhkjh", "sadfsadf1 2.2");

	assertAscOrder("2.30.2", "2.31");
	assertAscOrder("2.30.2", "3.0");
	assertAscOrder("2.3.2", "2.30");

	assertVersionEquals("2.3", "2.03");
	assertVersionEquals("2.3", "2.003");
	assertVersionEquals("2.3", "2.0003");

	assertVersionEquals("2.30", "2.030");
	assertVersionEquals("2.30", "2.0030");

	assertAscOrder("2.30.b2", "2.30.c2");
	assertAscOrder("test 2.30.b2", "test 2.31");
	assertAscOrder("2.b3.2", "20.0");

	assertAscOrder("blabla 2.30.b2", "clabla 2.31");
	
	assertAscOrder("20170814CBT-T24-WP1200","20170816CBT-T24-WP1199");
	assertAscOrder("20170814CBT-T24-WP1205","20170816CBT-T24-WP1199");
	assertAscOrder("20170814CBT-T24-WP1200","20170814CBT-T24-WP1205");
	
	assertAscOrder("20170814","20170814CBT-T24-WP1200");
	assertAscOrder("20170814","20170814 1");
	
    }

}

 


Examples

fixVersion in deployedAndPreviousVersions(Staging)

-> will return all issues having a fixVersion with a version number equal or lower to the version currently deployed to Staging environments.


unarchivedVersions()

since Version 3.11

Returns all unarchived versions. Nothing to do with environments or deployments but very useful to exclude archived versions from the deployedAndPreviousVersions() function.

Examples

fixVersion in deployedAndPreviousVersions(Staging) and fixVersion in unarchivedVersions()

will return all issues having a fixVersion with a version number equal or lower to the version currently deployed to Staging environments, but EXCLUDING the archived versions.