Skip to content

Bitbucket

Adding a new Repository

  1. Log in to Bitbucket as the client
  2. Click the Create button:

    Create button

  3. Choose "Repository"

  4. Enter the site name for "Repository name"
  5. Click "Create Repository"
  6. In the top-right, change HTTPS to Git SSH button
  7. Copy its value to the relevant Info Sharing ticket

Setting the main branch

This is the default branches all new branches should branch from. In our case, it should be LIVE

  1. Log in to Bitbucket as the client
  2. Choose Repositories from the left menu
  3. Choose the client's repository
  4. Click Settings button from the left menu
  5. Under General > Repository Details

Repository Details

  • Main Branch, choose LIVE: LIVE main branch

Adding Edmonds Commerce as Admin

  1. Navigate to the repository on Bitbucket
  2. Click Settings on the left
  3. Click "User and Group access"
  4. Search for, and click "edmondscommerce" in the "Username or email address" box
  5. Change "Read" to "Admin"
  6. Click Add

Adding Bitbucket as a remote

Note

You'll need to add your SSH key to Bitbucket first

  1. cd /path/to/repo
  2. git remote add bitbucket git@bitbucket.org:clientname/reponame
  3. git push --all bitbucket

Adding your SSH key to Bitbucket

  1. Log in to Bitbucket as the client
  2. Click the user's avatar in the bottom left and click Bitbucket Settings
  3. Click "SSH Keys" under Security
  4. Click "Add key"
  5. Add the container's hostname into "Label" and the container's public SSH key

Adding OAuth for Jira

Note

This is used for Jira's Bitbucket integration

  1. Log into Bitbucket as the client
  2. Click the user's avatar in the bottom left and click Integrations
  3. Click Integrations

    Integrations button

  4. Click OAuth (Under Access Management)

  5. Click "Add consumer"
  6. Fill in the form:
    • Name: [Client Name] Jira
    • Description: optional
    • Callback URL: (the Jira URL)
    • URL: optional
    • This is a private consumer: ticked
    • Permissions: Tick all the boxes
  7. Click Save Expand the newly created Consumer "ClientName Jira"
  8. Note down the Key and Secret in the Jira Info Sharing ticket

192.168.236.107

API

Calling endpoints

Need to ensure that there is an App password set up for the account, we can then set a user/password flag

curl -vvv --user username:password

Pull Requests

Create your pull request in BitBucket

Create a feature branch as normal. See the git page for more details about this

Work as normal on the branch, committing and pushing frequently until the feature is complete.

To do this you need to carry out the following steps

  • Go to the repo in BitBucket
  • Click on the Branches link in the left hand menu
  • Find your branch in the list and click on it

Tip

If there are lots of branches consider deleting old ones

  • Click the Create pull request link
  • At the top of the page there will be two boxes. The first is the branch you have been working on, the second is the branch that you want to merge into. This will default to master, so update it to the correct branch
  • This should populate the Title and Description with the branch name and a list of commits. Update this with any other relevant information
  • Tick the Close ${branch} after pull request is merged box. This will remove the branch from BitBucket and keep things tidy
  • Click the Create Pull Request button

Accept your pull request

At this point, you should glance over the pull request page to make sure there is nothing obviously wrong with the commits, and then click the merge button at the top of the page.

Update your local repo

cd /path/to/repo
BRANCH=(RELEASE|LIVE|other)
git checkout "${BRANCH}"
git pull bitbucket "${BRANCH}"
git push origin "${BRANCH}"

Await Feedback

At some point in the future someone will (should) review the pull request and leave comments on it. These should show up in slack (T.B.C.) and an email will be sent through to the projects inbox.

Reviewing a Pull Request

To review a pull request do the following

  • Go to the repo on BitBucket
  • Click on the Pull requests link in the left hand menu
  • Update the filter to Merged
  • Click on the pull request that you want to review

At this point you will have a list of the files that were changed and a diff. At this point you can add a general comment at the top, or as you go through the diff leave a comment on a specific line.