AUTOMATE JIRA TASKS TRANSITION WITH BITBUCKET-PIPELINE
Tags: pipelines, cicd, bitbucket, devops
Published: 2022-05-02 18:26:49


## AUTOMATE JIRA  TASKS TRANSITION WITH BITBUCKET-PIPELINE


**What are Jira tasks?**

Jira  tasks  represents the work needed to be done, Jira help a lot on  managing tasks  on Agile development process for many startups and growing companies like GitHub, Slack , Zendesk and more

As it  known that on agile developement  its import breaking functionality into small tasks  help keeping track of feature development progress, prioritization , testing and more advantages

As per my experience, most developers  know the importance of using the Jira boards but mostly we are forgetting to update tasks after making changes.

As as clickpesa team we looks on a way to automate that processes so as to help developers only to focus on development and let automation to do the rest 

Thanks for atlassian team for provide us out of box [automation](https://support.atlassian.com/cloud-automation/docs/jira-cloud-automation/) so we can  build solution  using it

**How did we use Jira automation?**

As clickpesa we have jira boards with columns as shown below


![alt text](https://res.cloudinary.com/clickpesa/image/upload/v1648307802/engineering-blog/images/c6memafbhsj2ofk9sspr.png)

It looks complicated :)? Dont worry you can define your columns depending on your workflow , as per our needs this setup fit to us

As more column means a lot of manual work and was sound tedious to a developer to update the tasks along the way that why we decided to look for a solution

With Taking advantage of Jira automation Triggers we did a magic for helping our self by saving energy of moving tasks manual

As to know estimation of accomplishment for a tasks we set manual process at beginning also to help developer to check their todos

**the following are steps on how we implemented it**
1. Developers will move tasks from **todo** to **select for development** in this step developers are required to fill their time estimation for a tasks accomplishment
1. Developers create branch by open  and the will see option to create Branch
<img src="https://res.cloudinary.com/clickpesa/image/upload/v1648307919/engineering-blog/images/n6xsdyiyy7horrdhyros.png" alt="drawing" height="200"/>
After creating the branch the task will move to **in progress** This trigger will be executed and move task to in progress<img src="https://res.cloudinary.com/clickpesa/image/upload/v1648307995/engineering-blog/images/r4hktcluu5a7fcw6owwd.png" alt="drawing" height="300"/>
1. Then after developer finish to work for a task he/she will create PR to a develop and then merge changes to develop the task will move from **in review** to **in develop**  (on merging to develop we have define tasks on pipeline to create another PR to staging) this is trigger for that
<img src="https://res.cloudinary.com/clickpesa/image/upload/v1648308077/engineering-blog/images/jrmqtvpsujsf7d34xpgx.png" alt="drawing" height="300"/>
1. As PR merged to staging the  task will move from **develop** to **staging**  (again PR to master will be created )  same trigger as above is used but now with consideration  to check if triggered task is **in develop** then is moved to **in staging**
1. After creating PR to master  the card is moved to **in Review**
<img src="https://res.cloudinary.com/dojg0fuxn/image/upload/v1648203434/Screenshot_2022-03-24_at_00.21.54_kzudog.png" alt="drawing" height="300"/>
1. Final  after PR reviewed and approved to go live the task  moved to **DONE**
this is trigger for it
<img src="https://res.cloudinary.com/clickpesa/image/upload/v1648308394/engineering-blog/images/zwb0ghlnjw4ccqmohtio.png" alt="drawing" height="300"/>

Yes, the job is done simple like that , developers cannot move tasks as it was before cool :)

This approach works well for two days until we get terrible problem one of our colleague who was  working to a specific  task after finish he create PR and merge it on develop  then pipelines fails he close PR and fix pipeline and create again PR and merge add notice that the task was not in correct column (issue occurs because we use trigger **when pull request merged** check current position of task them move to the next one )

So we looks on way to handle that  using Pipeline you can learn more on CI/CD in [here](https://www.atlassian.com/continuous-delivery/tutorials)

### **Solution 2**

------------



**What is the DevOps pipeline?**
as defined by [atlassian](https://www.atlassian.com/devops/devops-tools/devops-pipeline) DevOps pipeline is  a set of automated processes and [tools](https://www.atlassian.com/devops/devops-tools) that allows both developers and operations professionals to work cohesively to build and deploy code to a production environment.

What we did to solve issue mention above  is  let pipeline  decide where the tasks to be moved, the task will move if it meet our test cases defined on pipeline .we have been able to achieve that by using trigger know as **incoming webhook** , which provides us webhook url and we use that URL on pipeline when URL is executed on pipeline Action will be triggered 

<img src="https://res.cloudinary.com/clickpesa/image/upload/v1648308463/engineering-blog/images/cf3v6egywhpzhj14zc9o.png" alt="drawing" height="300"/>