2.1.0 • Published 3 years ago
bitbucket-env-manager v2.1.0
Bitbucket Deploy Pipeline Environments
A command line tool to manage Bitbucket pipeline deployment variables for different environments across multiple repositories
Installation
$ npm i -g bitbucket-env-managerUsage
$ bitbucket-env-manager <command_name>Available commands
init
generate
------
deploy
list
deleteInitialize Credentials
- Setup Oauth Consumer keys in bitbucket with proper env variable edit access.
- It should create
~/.bitbucket_env_manager/<workspace>.envfile - During the auth API calls, this should create access tokens in
~/.bitbucket_env_manager/<workspace>_tokens.jsonfile
bitbucket-env-manager init- Set
OAUTH_CLIENT,OAUTH_SECRETandWORKSPACE
Generate
$ bitbucket-env-manager generate- Creates a new project manager folder with example for bitbucket environments
- In
project_envs/example/info.jsonset the workspace and repository_slug names from bitbucket.workspacerepo
Deploy
$ bitbucket-env-manager deploy- Select multiple
.envfiles to be deployed to bitbucket fromproject_envsfolder. As indicated in example folder, the folder should
- contain .env file with name pattern
.env.{0|1|2}.{env_name}.{0|1|2}is for the rank of the environment to be created.- 0 -> Test, 1 -> Staging, 2 -> Production
{env_name}is the environment name to be created.
- contain
info.jsonfile, withworkspace: workspace namerepo: repository_slug namesecured: [], an Array with keys from the env file that need to marked as secured in bitbucket.envs_config:{ [env_name] : {admin_only:boolean} }, Config object for each {env_name}. admin_only boolean flag allows to specify if the environment needs to be restricted to be deployed by admins only.
Example:
.env.0.Developmentfilename deployment will delete any existingDevelopmentenvironment and variables from the bitbucket repository, and creates a newDevelopmentenvironment underTestCategory.- contain .env file with name pattern
List
$ bitbucket-env-manager list- Allows to list variables from existing environment from the repository
- Select the
info.jsonfile for the desired repository - Select the
env_namefrom the list to to view the variables from the environment in bitbucket.
Delete
bitbucket-env-manager delete- Allows to delete a existing environment from the repository
- Select the
info.jsonfile for the desired repository - Select the
env_namefrom the list to remove the environment from bitbucket.