npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sanofi-iadc/jival

v0.0.3

Published

Validation/health check tool for Jira workflows.

Downloads

2

Readme

Welcome to Jival!

Jival is a tool to help verify that Jira configurations are set correctly. Jival reads a list of expected Jira configuration settings (currently workflow, status and transition configurations) and checks these expectations against the actual configuration applied in Jira. All Jival results are in human readable form so that they can be easily used by non-technical people. Here's an example:

Workflow: "My test workflow" should be correctly defined
  Basic workflow configuration is correct
    ✓ Workflow exists
  Transition: "Create" should be correctly defined
    ✓ Transition exists
    ✓ Accepts transition from ""
    ✓ Transitions to "Draft" status
    ✓ Transition conditions match
    ✓ Transition validators match
  Transition: "Abandoned" should be correctly defined
    ✓ Transition exists
    ✓ Accepts transition from ""
    ✓ Transitions to "Abandoned" status
  Status: "Dev In Progress" should be correctly defined
    ✓ Status exists
    ✓ Status can only transition to "Blocked,Code Review,Ready to Dev"
    ✓ Status only accepts transition from "Blocked,Code Review,Ready to Dev"

Example use cases

  • You work in a highly regulated environment, and need an easy tool to provide some verification that critical parts of your Jira workflow are configured correctly when making changes
  • You want to run a regular health check on your Jira environment to catch human configuration errors and ensure that critical configurations are still set as expected
  • You have several Jira instances and need to check that configurations are the same between them

Checks

Workflow transitions

For each defined transition expectation

  1. Transition exists (search by name)
  2. From status list is the same
  3. To status list is the same
  4. Rules: conditions match
  5. Rules: validators match

Workflow statuses

For each defined status expectation

  1. Status exists (search by name)
  2. Status settings are the same (excludes ID)
  3. Status only accepts transition from expected statuses
  4. Status can only transition to expected statuses

Installation

Add the package to your project:

npm install @sanofi-iadc/jival

or

yarn add @sanofi-iadc/jival

Usage

Generate an Atlassian API token

Generate an API token using the instructions on this page: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/.

The account associated with the token must have admin privilidges to your Jira workspace. This is required because the Atlassian API requires these privilidges in order to read workflow configurations from the API. Jival DOES NOT make any configuration updates using the API, it is only used for read calls.

import {PerformWorkflowChecks} from @sanofi-iadc/jival;

// require the json configuration
let expect = require('jival_config.json');

const result = await PerformWorkflowCheck(expect.expectedWorkflowName, expect.expectedStatuses, expect.expectedTransitions, <YOUR_ATLASSIAN_URL>,
<YOUR_ATLASSIAN_EMAIL>, <YOUR_ATLASSIAN_TOKEN>);

console.log(result.toString());

Alternatively import the file without using require: tsconfig.json

"resolveJsonModule": true

Your script

import {PerformWorkflowChecks} from @sanofi-iadc/jival;
import {expectedWorkflowName, expectedStatuses, expectedTransitions} from 'jival_config.json';

const result = await PerformWorkflowCheck(expect.expectedWorkflowName, expect.expectedStatuses, expect.expectedTransitions, <YOUR_ATLASSIAN_URL>,
<YOUR_ATLASSIAN_EMAIL>, <YOUR_ATLASSIAN_TOKEN>);

console.log(result.toString());

Setting up config files

Jival expects three configuration options, explained below.

Basic principles

  • IDs should therefore be removed from your configuration files (see the example files), as these can vary within Jira. For example if you were to delete and recreate the same workflow a different ID would be assigned even if the workflow configuration was exactly the same.
  • Some verifications are done at object level, meaning that the object must contain an exact copy of the Jira API response in order to pass the verification. The easiest way to configure these is to query the API for your workflow and copy and paste that section of the response into your config file.
  • Expectations can be partial - you do not need to specify all properties. For example if you specify an expected status with only name and transitionTo properties, all other properties will be ignored when performing verifications. Name is mandatory as this is used to look up the Jira object.

expectedWorkflowName

Name of the workflow as a string, used to search the Jira API for the workflow to be verified.

expectedTransitions

An array of expected transition configurations, with all IDs removed.

  • name: name of the transition
  • from: array of strings containing status names which trigger this transition when transitioning to the 'to' status
  • to: the status when this transition has been completed
  • type: string containing the type of the transition (e.g. initial)
  • rules: object containing array of conditions and validators. Must be an exact copy of the Jira API response to pass verifications.

Example with simple configuration:

"expectedTransitions": [
      {
        "name": "Create",
        "from": [],
        "to": "Draft",
        "type": "initial"
      }
]

expectedStatuses

An array of expected status configurations, with all IDs removed.

  • name: string containing the name of the workflow
  • transitionTo: an array of strings containing the names of the Jira statuses which an issue can transition to from this status
  • transitionFrom: an array of strings containing the names of the Jira statuses which can transition into this status
  • properties: an exact copy of the properties of this transition taken from the Jira API
"expectedStatuses": [
      {
        "name": "Dev In Progress",
        "transitionTo": ["Blocked" , "Code Review"],
        "transitionFrom": ["Blocked" ,"Ready to Dev" , "Code Review"],
        "properties": {
          "issueEditable": true
        }
      }
    ]

Example files

The easiest way to get started is by using the example file in the examples folder. Try an initial run of your script with this configuration, changing the name of the workflow. You should see that the first test passes and the second test fails.