Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This guide is intended for partners and customers who want to use their own BitBucket as their Git repository and CI/CD tool instead of GitLab.

Make Before you start, make sure you have sufficient rights in BitBucket.

  1. Select the right Git repository.

  2. Navigate to Repository settings > Pipelines > Repository variables.

  3. Click Variables and create variables PFX_USER and PFX_PASS:

    • Add the variable PFX_USER and set its value to pfx.deploy and click OK.

    • Add the variable PFX_PASS and set its value to be a strong password (at least 14 characters, at least 1 digit, at least 1 capital letter). Select Keep this value secret and click OK.

  4. Navigate to Repository settings > Pipelines > Deployments.

    1. Create required environments

    2. For each environments create variable for URL with partition url.

  5. Navigate to Repository settings > Pipelines > Settings.

    1. Enable Pipeline

    2. Click on “Configure bitbucket-pipelines.

    Select Starter Pipeline and replace the existing editor content with the
    1. yml”

    2. Commit the yml file.

    3. Create a feature branch for Pipeline and fetch the yml file in intellij.

    4. Replace the existing code with following:

      Code Block
      image: maven:3.6-jdk-11
      
      pipelines:
        branches:
          dev:
            - 
    variables
    1. step:
                
    -
    1. name: 
    URL
    1. dev
                script:
       
    default: "https://qa.pricefx.com"
    1.            - 
    name:
    1. mvn 
    PARTITION
    1. clean test -e --batch-mode
       
            
    default: "sandbox
    1. -
    qa"
    1.  
    -
    1. step:
                name: Deploy DEV
               
    image: pricefx/pfxpackage trigger: manual
    1.  deployment: DEV
                
    script: #PFX_USER: should be set as masked variable in project's settings on BitBucket -> Settings -> CI/CD -> Variable
    1. image: pricefx/pfxpackage
                
    #PFX_PASS: the same applies to PFX_PASS do not ever put it here
    1. script:
                  
    1. - pfxpackage -import -timeout 120 -url $URL -user $PFX_USER -password $PFX_PASS -partition 
    $PARTITION
    1. {partition-name} -from . $OPTIONS
      
    Click Save. This will create bitbucket-pipelines.yml file in the root directory of your project
    1. Replace the {partition-name} with dev partition name.

    2. Create the similar pipeline for other partitions if required.

    3. Add Pom.xml to the project

    4. Add the project as Maven project

    5. Commit the file and create the Pull request.

  6. Create a user account pfx.deploy in the target partitions (QA, PROD) and assign this user the General Admin privileges in each of the partitions where you want to enable deployment and set the password to be identical to the PFX_PASS variable.

  7. After merging the pull request for Pipeline branch with dev branch, Pipeline should start

Notes:

  • You should set name to correspond to your partition, eg. Deploy QA or Deploy PROD.

  • You must set the PARTITION and URL variables to the right values of your environment. You must set which branch to use for the source under the trigger section.

See also: https://support.atlassian.com/bitbucket-cloud/docs/bitbucket-pipelines-configuration-reference/