StagingPro Enquiries: +44 20 4547 9292

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 7 Next »

Bitbucket Account Setup

Step 1: Sign up or log in to Bitbucket Account

  • Visit Bitbucket's official website, create an account, and log in.

Step 2: Create Workspace

image-20241029-112338.png

  • Upon logging in, click “Create workspace.”

  • Provide the workspace details and proceed.

image-20241029-112422.png

Step 3: Create Repository

image-20241029-112437.png

  • Add Repository:

    • Enter Project Name

    • Enter Repository Name

    • Set Access Level

    • Important: Always set the default branch name as "main."

  • After successfully creating the repository, a URL similar to this will be generated: https://bitbucket.org/{workspace}/{repository}/src/main/.

in stagingpro you need URL like this workspace/repository e.g.,“themedeploy-stagingpro/stagingpro-repo/

Step 4: Add User to Bitbucket Workspace and Repository

  1. Navigate to the repository and click on the settings icon.

  2. Go to "User Management" and click on "Invite."

    1. Here click on Invite button and the redirect to Invite people to Bitbucket screen.

      • Enter the bitbucket@stagingpro.com

      • Product Role: Click on the drop down field and click on the relevant checkbox

      • There will be 3 group permissions:

        • bitbucket-admins

        • bitbucket-user-access-admins

        • butbucket-users

      • Select the group permission "bitbucket-admins-themedeploy-stagingpro" 

  3. Add stagingpro as a user, assign it "Admin" permission at the repository level

    1.   Now again go back to previously selected repository then click on Invite it will redirected to repository permission and then again click on "Add user or group "

  4. Click on Invite users button to send the invitation

  5. For additional users:

    • Assign developer permissions.

    • Follow similar steps, but assign different permissions.

image-20241029-113140.png

image-20241029-120549.png

Step 5: Verify Repository

  1. Log in to StagingPro and connect to Bitbucket.

  2. Enter the repository URL in StagingPro under Settings > Connect Repository.

  3. Click on Verify Bitbucket Account, Grant access and you will receive a success message.

image-20241029-115326.pngimage-20241029-115403.pngimage-20241029-115427.png

Step 6: Add Team Members

  1. Click on Add Team member, a popup window to enter Bitbucket username and Bitbucket name will be displayed

image-20241029-121814.png

  1. To get username and name, sign into Bitbucket account, click on the settings cog wheel on the top right-hand corner and then click on “Personal Bitbucket Settings”
     https://bitbucket.org/account/settings/ 

image-20241029-120917.png
  1. In the following screenshot, you can get the Bitbucket name and Bitbucket username as follows:

    1. Bitbucket Name:  Theme Deploy

    2. Bitbucket Username: themedeploy

image-20241029-121116.png

  1. Enter the Bitbucket username and Bitbucket name and click on save. Then the following popup window to select the environment type will be displayed. Click the checkbox on the desired environment for branch creation and click on confirm button.

image-20241029-122138.pngimage-20241029-122529.png

Step 7: Change Permissions / environment type

Click on the Change permission button to remove existing environment or select any other environment.

image-20241029-123112.png

Step 8: Remove User

To remove a user, click "Remove" in StagingPro. This action removes the user from StagingPro but not from Bitbucket.

image-20241029-123230.png

Create OAUTH Token

1) Add OAuth Consumer

Click on Settings > workspace settings > OAuth Consumer > Add Consumer

image-20241029-123645.png

image-20241029-123915.png

2) After entering all the necessary fields on the OAuth Consumer form, click on save.

https://bitbucket.org/bigisagingpro/workspace/settings/api

Code Deployment Process

   a) Workflow for direct commit

Clone the environment branch by using the command 

git clone --branch $branchName https://userId:$oauthToken@bitbucket.org/ravistaging/stagingprobigi.git $branchName

  1. After cloning branch go the folder Make some changes in the files

  2. Open gitbash and write cd  Productione160c1(“cloned folder);

  3.  git clone --branch branchname https://bigistagingprolatest:$authtoken@bitbucket.org/bigistagingpro/stagingprostaging.git branchname 

  4. After cloning branch do cd branchname  

  5. Make changes in the required file

  6. git status to check the changes 

  7. git add --all : to add all the changes

  8. git commit -m 'Commit Message'

  9. git push origin branchname

  10. Then go to code deployment screen there you can see the direct commit changes like this                                                                                                                                                                                                                 

  11. By clicking on “Generate Preview and Approve Later” link user can launch Preview for direct commit                                                                                                                                                                                                 

  12. Click on “Approve and Deploy to initiate deployment

    1.  Workflow for Pull Request

      1. Create Pull request in your bitbucket account under repository section 

      2. See the left menu and click on “Pull request”

  13.  Click on create pull request on the top right side then select the Environment branch for the destination branch dropdown.                                                                                                                                                           

    1. you will see this screen where you can add your comment and then click on “approve” and “merge”                                                                                                                                                                                        

  14. After clicking merge you will see this screen 

  15. You can add your comment but do not made modifications on top commit message like “Merged in Akanksha247e160c1472899 (pull request #12)” and simply click on “Merge” button Then you will start seeing entries like this under “Code Deployment” 

Here you can see the generate Preview link click on “Generate Preview and Approve Later” link and select the correct note version from dropdown and then again click on “Launch Preview” button.

After generating Preview you will see screen like this

Click on “Preview Ready”

Click on Top link like  this “https://fifty-olives-prove.loca.lt” to see the preview.

Click on Approve and Deploy then you will see screen like this 

After some time refresh the page and click on "Deployment logs" and  by going down see latest comment similar like this “Bundled saved to:  20240223-6.5.0.zip which means theme is downloaded properly and now the stencil server Cron will pick the theme and do the deployment.

Maximum Theme Notification: 

In some case if user already have maximum no of theme which is 20 then user will see screen below screen then please select the theme user want to delete, click ok and then refresh the page to see the update.   

                                                                                                                                                                                Staging Pro Deployment workflow

The following illustration shows the suggested ideal process as part of the Git development workflow with Pull request, that can be implemented as part of your StagingPro setup.

And the following illustration shows the suggested ideal process for hot fixes as part of the Git development workflow with direct commit to the Production environment.

As a general rule of thumb, developers first commit codes to their local branch, before it reviewed and approved for merge with a shared branch (e.g. Production branch)

After StagingPro is linked with your Git repository, the active branches are programmatically generated and these names must NOT be changed.

StagingPro Git Branch workflow

As part of theme deployment workflow, consider the following StagingPro setup showing your mapped environments for Production, Staging and UAT.

Now consider BitBucket users (developer and designer) added to StagingPro using the ‘Connect BitBucket’ tab

The following ‘Git Branches’ illustration, highlights the flow that brings the following components together:

  • StagingPro repository on your Git Organisation

  • Webhook configured environments Production, Staging, UAT

  • Storefront channels per environment

  • BitBucket users developer and designer.

  • BitBucket user branches

StagingPro Git Branch Code Deployment

This is accessible under the ‘History & Rollback’ tab and click on ‘Code Deployment’ sub-tab. This shows the list of git commits of your connected BitBucket repository that is visible within your StagingPro environment

Status case: Awaiting Approval

A Git commit is visible on the grid, but requires your approval before the code is merged to the respective environment.

You get two options:

  • Approve and Deploy - where you can deploy the code straightaway

  • Generate Preview and Approve Later - where you can preview the codes on a generated preview site for visual reference

If you click to Generate Preview, you can select the version of Node.Js compatible with your Git commit preview and click to Launch. Please give it some time (up to 5 minutes) as it spins up a temporary preview url for visual validation.

Status case: If you approve the code

The code will be committed to the respective branch and you will see the status of ‘Merge Successful | Theme deployed’
You will also see a ‘Rollback’ option to rollback to a previous version if required.

Status case: If there are errors/conflicts

If a conflict is detected in config.json, click to view and resolve any errors/conflicts

Status case: If you reject the code

The status will show as ‘Rejected|Code Not approved’

A few BitBucket FAQS

Q1. After giving Admin access to StagingPro Git repository, I see some autogenerated code branches e.g. Productione347c1, so should I keep the names as it is?
A1. Yes, that is correct. These environment branch names are autogenerated and required for code commit tracking. Please do not delete or rename these branches as it will affect the BitBucket integration.

The branches are created i) per environment ii) per channel and iii) per team member

Q2. What is the purpose of developer branches?
A2. As best practice, developers are given their own branches so they can commit their codes to their own branch at the first instance, or for more frequent code commits at the developers convenience without affecting the environment branch.

Q3. Are there any benefits to using a developer branch over a more typical git feature branch (e.g. feature/TICKET-description-of-the-change)?
A3. Yes indeed! The developer can commit to their branch first. Once the task is complete, they can merge the code from their branch to the environment branch. If many developers are working on a common task, they can commit codes to each of their individual branches without affecting the other developer branches. And can merge their code easily.

Q4. What purpose does the Main/Master branch serve in a typical setup?
A4. Master branch is generally used as a buffer branch and is the default branch while creating a repo in BitBucket. This master ‘buffer’ branch can be left as it is. Instead use the autogenerated active branches that is automatically (with a name such as Productione347c1) created during your BitBucket integration and linking process.

Q5. Is there a way to export from Bigcommerce to BitBucket through StagingPro? Or will I need to download the current theme through storefront and upload it to BitBucket separately?
A5. As long as BitBucket integration is connected and at a minimum, one team member user is added in the ‘Settings’ section, then yes - StagingPro automatically downloads the theme into the connected branch.

Q6. When I commit changes in BitBucket, will those changes will appear as rollback options in StagingPro?
A6. Correct. After the BitBucket integration is set, commit changes are tracked and rollback options are visible on the deployments grid.

Q7. Can you explain how version control works for StagingPro with multiple development teams as part of existing CI/CD pipelines?
A7. When you successfully configure the BitBucket integration on your StagingPro tenant, your GIT commits will be visible on the ‘Code Deployment’ tab which displays incremental version numbers. The code branches are created i) per environment ii) per channel and iii) per repo team member. Refer the ‘StagingPro Git Branch workflow’ section of this document. Under Settings > Status Notifications you can enable the Deployment Notifications checkbox for team notifications through i) Email ii) Teams and iii) Slack for shared visibility and effective collaboration.

             

 

  • No labels