Skip to content

A Python script, running inside a Docker container, to add a group to one or all repositories in a Bitbucket workspace.

Notifications You must be signed in to change notification settings

thomashenson/add-bitbucket-group

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Add a Group to a Multiple Bitbucket Repositories

A script to bulk-add a group to Bitbucket repositories.

What is this repository for?

This script, running inside a Docker container, will add a group to multiple Bitbucket repositories at once.

Run the Script

To run the script, simply run the following commands, with 'x' being incremental versions:

docker build -t update-groups:1.x .
docker run update-groups:1.x

You will need to create a 'vars.json' file in the root directory of the cloned repository, formatted as follows:

{
    "username": "joe.bloggs",
    "password": "password",
    "workspace_id": "my-workspace",
    "repo_slug": "my-repository",
    "group_owner": "group-owner",
    "group_slug": "my-group",
    "privilege": "write"
}
  • Username: This is your personal Bitbucket username.
  • Password: You will need to generate an app password for this. **
  • Workspace ID: The name of the workspace.
  • Repo Slug: The name of the repository the group needs to be added to. Leave blank for all repositories in the workspace.
  • Group Owner: The owner of the group to be added. If left blank, will be set to Workspace ID.
  • Group Slug: The name of the group you would like to add to the repositories.
  • Privilege: The privilege to be given to the group; 'read', 'write', or 'admin'.

** When you generate an app password, you will need to ensure you select Read and Write (and Admin under Repositories only) under Account and Repositories.

The 'vars.json' file is excluded in the .gitignore. I changed to reading in a vars file as the input vars were inconvenient. Easier to re-run this way.

Requirements

  • Docker installed and configured on your machine.
  • You need to be a Bitbucket admin.

About

A Python script, running inside a Docker container, to add a group to one or all repositories in a Bitbucket workspace.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published