Purpose of this article;

It will be explained how Bitbucket and Jira Cloud can work together and how Bitbucket Pipelines can be added to this structure.

Technologies required for this article

  • Jira Cloud account
  • Bitbucket Cloud account
  • Internet access
  • IDE (Intellij Idea, VS Code vs.)

NOTE 1: Accounts must be opened on Jira Cloud and Bitbucket Cloud before continuing.

NOTE 2: Since Bitbucket Pipelines is only in Cloud version, this structure can’t be set up on Server or Data Center.

Step 1: Creating a project in Jira Cloud and integrating it with Bitbucket Cloud

  1. A project to be created must be integrated with Bitbucket Cloud. For this, go to “Projects > Create Project” in Jira.
  2. Choose one of the Scrum, Kanban or Bug Tracking templates. Scrum will be selected in this document.
  3. In the Project Type section, one of the Team-Managed or Company-Managed options is selected. In this document, Company-Managed will be selected.
  4. The name of the project is written on the Project Details page. “Jira and Bitbucket Integration” will be written in this document.
  5. Clicking “Next” and continuing, the Bitbucket Cloud connection screen will appear. If Jira Cloud and Bitbucket Cloud are created with the same e-mail address, it will automatically appear on the screen. If it was created with different accounts, select the “Add Tools” option and continue from there. In this document, since it appears automatically on the screen, it will be continued directly.
  6. The repo name to be created in Bitbucket will be the same as the project created in Jira.
  7. After connecting the project to Bitbucket, a page written “Your Work is Now Connected” will appear. There you can say “Go To Project” and go to your project created in Jira. Or you can go to Bitbucket by clicking “View” next to the created repo. This document will navigate to Jira.
  8. To observe that Bitbucket is connected, go to “Development > Code” on the screen that comes up.
  9. Bitbucket appears to be connected.

Step 2: Creating an Issue and observing the connection that will occur in the stream from Jira in Bitbucket.

  1. In order to create a branch, we first need to push the code. So it goes to the repo created in Bitbucket.
  2. The code in the compiler is pushed to Bitbucket as its master branch.
  3. In the “Source” field in the Bitbucket repo, the code is observed and returned to the Jira Cloud.
  4. “Create” is selected and Issue is created.
  5. After it is created, go to the Issue screen and the “Development” line should be seen in the “Details” field.
  6. Select “Create Branch” next to the Development line.
  7. This will automatically redirect us to Bitbucket.
  8. By default, the branch name to be created will be the same as the name of the created issue. This can be changed according to preference. This document will continue unchanged.
  9. Returns to Jira after creating it. After refreshing the page, it is observed that “1 branch” is written in “Details > Development”.
  10. When you click on it, branches, commits, PR and MRs are observed.

Step 3: Preparing Pipeline setup in Bitbucket.

  1. Go to the “Jira and Bitbucket Integration” project created in Bitbucket.
  2. Pipelines option in the menu is selected.
  3. The screen that comes up is the default page of Pipelines. In the “Create Your First Pipeline” field at the bottom of the page, the template suitable for the code structure is selected. Here, “Starter Pipeline” will be chosen to address the general situation.
  4. The screen that comes up is the screen where Pipelines will be edited. Default pipelines only have echo commands. The Pipeline structure can be customized and expanded with the options on the side. If you need to examine them;
    • In the “Change Template” field, we can change the template structure that we selected on the previous page.
    • In the “Add More Steps” field, we select what kind of structure we want the new steps we want to run to our pipeline setup (they work together in parallel or one by one, etc.) and the pipeline adds accordingly.
    • The “Add Pipes” area is an environment where we can use other applications in the pipeline structure. Here, you can select the environment to deploy, specify the environment to send notifications, and construct structures where you can put the process to the test. In this way, there are about 90 environments and features.
    • In the “Add Variables” field, we define the values that we want to use as variables or parameters in the Pipeline setup.
  5. In this document, Heroku will be used as the deploy environment.
  6. Heroku Deploy is selected in the Add Pipes field.
  7. On the screen that comes up, it shows how it will be added to the pipeline and what parameters it wants in which type. More information can also be accessed from the details, examples and support section.
  8. How to add it is shown below.
  9. After the desired parameters are entered properly, we add our code to the desired branch with “Commit File”.
  10. For the pipeline to work, it must either be triggered manually or a PR must be created on the created branch.
  11. After one of these two operations is done, Pipelines is visited and it is observed whether the operation is successful or not. If it was successful, it will be observed by going to whichever environment the deploy was made to. And the pipeline setup is completed.

Almbase Technology 2024. All rights reserved.