bvapigee
v0.0.1
Published
Apigee CLI
Downloads
14
Readme
apigee-cli
CLI tool desinged to aid the CI/CD process of Apigee artifacts, even across different Apigee instances.
Installation
npm install -g git+ssh://[email protected]:bazaarvoice/apigee-cli.git
Usage
Terminology
export
: download artifact from the specified Apigee source instanceinclude
: using the previously exported artifacts, add the respective files into your Apigee configuration sourcepackage
: using the previouslyincluded
sources, package them so that they can be imported into an Apigee instanceimport
: create/update artifact in the specified Apigee destination instance
config.json
Create config.json
from config.json.example
credentials
: default credentials to be used forsource
anddestination
configurationssource
: defines Apigee instance which will be queried- can specify own
credentials
configuration
- can specify own
destination
: defines Apigee instance which will receive updates- can specify own
credentials
configuration
- can specify own
directory
: specifies the directories which will be used for the various artifact related processesplugins
: specify the globally installed plugins to load
Methodology
This tool does not perscribe much about how CI/CD must be done. It's only requirements are that you specify known locations
of where artifacts will be exported
, included
, and packaged
. Given those facts, any number of custom CI/CD processes
can be implemented.
Proxy Cloning
Apigee Edge UI does allow for multiple developers to edit Apigee artifacts in a maintanable manner. Developers can inadvertantently
make conflicting changes to artifacts. For this reason the concept of proxy cloning
has been added to this tool. Given a proxy name and a label, a unique identifier, a clone of the proxy can be created alongside all of its dependencies (sharedflows, kvms, etc). All of the dependencies will also adorn the specified label.
A developer can now make and test changes in an isolated way via the Apigee Edge UI without having to worry if another developer is also making changes.
Basic Proxy Cloning Workflow
- Clone desired proxy
apigee proxy clone create myproxy mylabel
- Deploy desired proxy
apigee proxy clone deploy myproxy mylabel
- Make changes to proxy clone in Apigee Edge UI
- Export changes made to proxy clone
apigee proxy clone export myproxy mylabel
- Apply the changes to source
apigee proxy include --name myproxy
- Commit changes to source control
- Package and deploy updated proxy
apigee proxy package --name myproxy
apigee proxy import --name myproxy
Commands
Every command has a help
subcommand, use it to get details about the command:
apigee help
Any value defined in the config.json
can be overriden via CLI arguments:
apigee kvm list --source.organization <org> --source.environment <env>
Plugins
Plugins are yargs commands exported from an npm package.
A plugin package needs to export a yargs CommandModule
object which apigee-cli
will load and expose the
underlying commands.
- Export a yargs
CommandModule
from plugin package
import yargs from 'yargs';
const Command: yargs.CommandModule = {
command: 'bv <command>',
describe: 'bazaarvoice commands',
builder: (yargs: yargs.Argv) => {
return yargs
.commandDir("cmds");
},
handler(/*args: any*/) { }
};
export = Command;
- Install plugin globally for
apigee-cli
to be able to load
npm install -g your-plugin
- Add the plugin package to
config.json
"plugins": ["your-plugin"]
- Your plugins commands are now available via
apigee-cli
:
apigee help
Development
- Fork the repo
- Clone your fork
Requirements
- nvm for Node version management
brew install nvm
- run
nvm install
andnvm use
commands inside the project directory- the
.nvmrc
will be used to determine which node version to install and use
- the
- Visiual Studio Code for editing and debugging
brew cask install visual-studio-code