July 11, 2022

Standardizing CI Workflows with Harness Continuous Integration and Jira

Table of Contents

Continuous Integration (CI) and Continuous Delivery (CD) have taken a premium slot in any organization's DevOps journey. For most companies, it all starts with setting up a Continuous Integration platform that has strong integration with an issue tracking tool. Atlassian's Jira platform is one that has wide adoption across many industries. Harness has a Req, and today, we will see how Harness CI and Jira work together with a simple setup and example. 

While developers work on different projects in an organization and continuously do CI for them all, they need a standardized way to ensure the entire workflow functions as expected. Jira approvals make it easy for developer peers, managers, and code reviewers to smooth out the CI/CD workflow. 

In the first phase of this tutorial, let’s build, test, and push our artifacts to the Docker registry. Since Harness CI is language-agnostic, you can write your applications in any language to build an artifact. The DSL of Harness CI is YAML.

We will connect to your Git repository and select the branch to build, and once completed, Harness CI will run the tests through Harness Test Intelligence, a capability in the Harness CI module that uses machine learning to automatically select the tests that need to be run. Instead of running all tests, which can take hours, Test Intelligence designates a subset of only relevant tests and skips the rest. Test Intelligence is so smart that it ranks tests in an optimal order to increase the rate of fault detection. This is a powerful feature and a game-changer in the world of CI solutions. 

Once tests are run through Test Intelligence, Harness CI then builds and pushes the build image to any container repository (for example, Docker Hub). Then, you can edit your pipeline through the Harness UI Pipeline Studio, which makes it easy to play around and see things working quickly. 

The included YAML editor provides an IDE-like experience, making it easy to edit your pipelines and understand things practically. It also features autocomplete and schema validation, which act as additional safeguards against human error.

Tutorial

First, we initialize. Here, all required things will be set.

We clone the pull request.

At this stage, unit tests will run through Test Intelligence. This helps you get quick feedback on the quality of your code, and reduces necessary effort by helping fail fast and find bugs early in the development phase. 

Finally, we build the image and push it to the Docker Hub.

You can go to your Docker Hub and check if the image is pushed as suggested in the CI pipeline.

Jira Integration

The Harness integration with Jira supports all your ticketing needs.

You can use Jira approvals in two ways:

  1. Add a Jira approval stage to any CD or approval stage
  2. Add a Jira approval stage that includes Jira create, Jira approval, and Jira update steps.

Here’s a simple example of Jira create, approve, and update after the deployment stage.

Click on Add Stage. 

Add the approval stage.

Select Jira and set up the stage. You can also add the create and update stages from the execution stage separately.

You will then be presented with the following screen. Fill out the required details. 

Here are some examples after filling in the details to automatically create the Jira ticket:

You can use any of the specified approaches for the approval criteria - conditions or JEXL Expression. I would like to call out that the Issue Key is using an expression, a variable that was set in a previous stage. For this tutorial purpose, we have used JEXL Expression for the approval criteria. You shouldn't have to use JEXL for the approval criteria. The conditions should automatically prompt you for issue fields and statuses.

Save and run the pipeline. It runs until the approval stage, and waits for the approval of the pipeline.

The approver should now get a notification in Jira, and they should be able to approve or reject the pipeline. 

Once approved, check the logs. You should see something to this effect: 

The complete steps can be seen below:

Conclusion

With Harness, we can easily integrate Jira and automate tasks to help the dev, ops, and test teams collaborate, reducing the extra burden of managing and tracking tasks and issues in the organization. 

We’d love to help your teams become more efficient. Request your demo, download a free trial, or visit Harness in the Atlassian marketplace to see how Harness can help modernize your software delivery processes.

You might also like
No items found.

Similar Blogs

No items found.
Continuous Integration