Deploy only what changed in your Apigee configurations.
This tool finds differences in Apigee Configuration files (KVMs, Target Servers, API Products, etc.) between two Git commits and uses the Apigee Config Maven Plugin to apply only those changes.
Standard Apigee configuration deployments often re-deploy the entire configuration set, which can be slow and risky for large organizations. This tool allows for incremental deployments:
- Speed: Only process files and resources that actually changed.
- Safety: Reduce the risk of accidental overwrites of stable configurations.
- CI/CD Friendly: Designed to run in pipelines (Jenkins, GitHub Actions, GitLab, etc.).
- Diff: Compares two Git commits (e.g.,
HEAD~1vsHEAD). - Generate: Creates two temporary trees in
output/:update/: New or modified resources.delete/: Resources removed or items deleted from within modified files.
- Deploy: Runs
mvn installon both trees with theupdateordeleteoption.
- Python 3.10+
- Maven (
mvn) installed and in your PATH. - (Optional)
treecommand for better dry-run visualization.
Install directly from GitHub:
pip install git+https://github.com/apigee/devrel.git#subdirectory=tools/apigee-config-diffBy default, the tool compares HEAD~1 with HEAD in the resources/ directory.
apigee-config-diffAdd the --confirm flag to actually execute the Maven commands.
apigee-config-diff --confirm| Argument | Default | Description |
|---|---|---|
--commit-before |
HEAD~1 |
Previous commit hash to compare. |
--current-commit |
HEAD |
Current commit hash. |
--folder |
resources |
Folder containing the Apigee config tree. |
--output |
output |
Where to generate the temporary diff trees. |
--confirm |
False |
Must be present to execute mvn commands. |
--bearer |
None |
Optional: Apigee bearer token to use for Maven. |
--sa-path |
None |
Optional: Path to the service account key file. |
The tool passes authentication flags directly to the Maven command. You can provide them in three ways:
-
Command Line (Recommended):
apigee-config-diff --confirm --bearer "$(gcloud auth print-access-token)" # OR apigee-config-diff --confirm --sa-path /tmp/sa.json
-
Environment Variables: If your
pom.xmlis configured to use environment variables (e.g.,${env.bearer}), simply export them before running the script:export bearer=$(gcloud auth print-access-token) apigee-config-diff --confirm
-
POM Configuration: Hardcode the service account path or token directly in your
pom.xml(not recommended for CI/CD).
The tool expects the standard Maven config structure inside your --folder (default resources/):
<org-name>/
├── org/
│ ├── apiProducts.json
│ ├── developers.json
│ └── ...
└── env/
├── <env-name>/
│ ├── targetServers.json
│ ├── kvms.json
│ └── ...
Note: File names must start with the resource type (e.g., targetServers-backend.json is valid).
Run tests with:
pytest