Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jan 08, 2020 11:14

This section guides you through deploying Bitbucket as a CI/CD tool in your environment so that you can observe the test runs from the CI Dashboard view and view links to the CI Dashboard view in Slack and Jenkins. 

To help you get started and as a point of reference, we have made a sample project available here: https://bitbucket.org/perfectops/maven_slack_bitbucketsample/src/master

1 | Sign up with Bitbucket

To sign up and try Bitbucket for free, follow the steps at https://bitbucket.org/account/signup.

On this page:

2 | Upload a Maven project to Bitbucket

  1. Log in to Bitbucket.
  2. On your own work tab, click Create repository.

     Click to view image
  3. In a terminal window, do the following:
    1. Switch to your repository's directory.
    2. Connect your existing repository to Bitbucket with the following git commands:

      	git init
      	git remote add origin https://<username>@bitbucket.org/<username>/<repo name>.git
      	git add .
      	git commit -m "first commit"
      	git push -u origin master

      where <username> refers to your Bitbucket username and <repo name> refers to the name of your repo in Bitbucket.

3 | Set up a pipeline project in Bitbucket

  1. On the Pipelines tab, do one of the following:
    • Select your preferred sample pipeline and click Commit file to automatically start the pipeline. For more information, see this Bitbucket article.

       Click to view image
    • If you plan to reuse the bitbucket-pipelines.yml file or if you already have a pipeline in your project, click Enable.

       Click to view image
  2. Validate your pipeline.yml file. You can use this validator.
  3. On the Settings tab, under Repository variables, use the Name and Value fields to provide the following information. Make sure to select the Secured checkbox for each name/value pair to securely store the values from the console.

     Click to view image
    • The username for your Perfecto cloud

      Note: You may want to skip securing the name of your Perfecto cloud. If you do secure it, the name will not show up in the Single Test Report URL that appears in the console.

    • Your Perfecto security token
    • The slack_hook to store the Incoming Webhook URL of your Slack app (For more information on integrating with Slack, see this Slack article.)
  4. Optionally, manually trigger the pipeline as follows:
    1. On the Pipeline tab, click Run pipeline.
    2. Select the branch and pipeline and click Run.

       Click to view image
  5. To schedule jobs in Bitbucket, see this Bitbucket article.
  6. Review the results of the pipeline execution in the CI Dashboard view of the Perfecto UI.

     Click to view image

    With Slack integration, you receive a link to the CI Dashboard in a Slack notification.

     Click to view image

    To view the pipeline execution in our sample project, go to https://bitbucket.org/perfectops/maven_slack_bitbucketsample/addon/pipelines/home#!/results/2.

4 | Integrate Bitbucket with Jenkins and Slack

  1. To integrate with Jenkins:
    1. See the Jenkins with Maven article.
    2. Under source code management, set the Git repository to your Bitbucket repo URL and select your Bitbucket credentials.

       Click to view image
  2. To integrate with Slack, see the Slack integration article.