Skip to end of banner
Go to start of banner

How to add branch level restriction using Bitbucket CLI

Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

« Previous Version 5 Next »

This article explains how to add branch level restriction using Bitbucket Command Line Interface (CLI) app.

Instructions

Use the runFromBranchList CLI action to get the list of branches for a repository and addBranchRestriction to add branch level restriction.

  1. Ensure that the CLI client file is updated with the required information. 
  2. Execute the below CLI action: 

    --action runFromBranchList --project "project1" --repository "repository1" --common "-a addBranchRestriction --project "project1" --repository "repository1" --branch @branch@ --group "group1""

    Output:

    Run: -a addBranchRestriction --project project1 --repository repository1 --branch admin/COTtxt-1585834077505 --group group1
    Branch restriction 'read-only' added with id 1.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch master --group group1
    Branch restriction 'read-only' added with id 2.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch ABCD5-1-testing-4132 --group group1
    Branch restriction 'read-only' added with id 3.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch develop --group group1
    Branch restriction 'read-only' added with id 4.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch develop1 --group group1
    Branch restriction 'read-only' added with id 5.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch developer --group group1
    Branch restriction 'read-only' added with id 6.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch admin/COTtxt-1585649449127 --group group1
    Branch restriction 'read-only' added with id 7.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch admin/COTtxt-1585647043498 --group group1
    Branch restriction 'read-only' added with id 8.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch admin/COTtxt-1585646764820 --group group1
    Branch restriction 'read-only' added with id 9.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch testbranch --group group1
    Branch restriction 'read-only' added with id 10.
    
    Run: -a addBranchRestriction --project project1 --repository repository1 --branch branch1 --group group1
    Branch restriction 'read-only' added with id 11.
    
    Run completed successfully. 11 actions were successful 
    
    
  3. Verify in the Branch permissions page to see the added restrictions.


  • No labels