bitbucket-env-manager
v2.1.0
Published
Deploys Bitbucket Environment
Downloads
18
Maintainers
Readme
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-manager
Usage
$ bitbucket-env-manager <command_name>
Available commands
init
generate
------
deploy
list
delete
Initialize Credentials
- Setup Oauth Consumer keys in bitbucket with proper env variable edit access.
- It should create
~/.bitbucket_env_manager/<workspace>.env
file - During the auth API calls, this should create access tokens in
~/.bitbucket_env_manager/<workspace>_tokens.json
file
bitbucket-env-manager init
- Set
OAUTH_CLIENT
,OAUTH_SECRET
andWORKSPACE
Generate
$ bitbucket-env-manager generate
- Creates a new project manager folder with example for bitbucket environments
- In
project_envs/example/info.json
set the workspace and repository_slug names from bitbucket.workspace
repo
Deploy
$ bitbucket-env-manager deploy
Select multiple
.env
files to be deployed to bitbucket fromproject_envs
folder.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.json
file, 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.Development
filename deployment will delete any existingDevelopment
environment and variables from the bitbucket repository, and creates a newDevelopment
environment underTest
Category.- contain .env file with name pattern
List
$ bitbucket-env-manager list
- Allows to list variables from existing environment from the repository
- Select the
info.json
file for the desired repository - Select the
env_name
from 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.json
file for the desired repository - Select the
env_name
from the list to remove the environment from bitbucket.