In this article, we will see how to create a CI/CD pipeline for APIGEE API proxies. I have referred a couple of articles on APIGEE community on the same topic. Those gave some idea on how to setup CI/CD pipeline for API proxies. Here are the tools which I have used to setup CI/CD.
Make sure that you have created APIGEE edge account and a sample proxy to start with. Below is the architecture diagram which shows the CI/CD pipeline and the stages involved. You can use this as a baseline CI/CD for your projects and can enhance it based on your requirements.
Here are the steps I have implemented in CI/CD pipeline.
- Developer pushes the API proxy code to GIT.
- Jenkins polls GIT and starts CI/CD Stage 1 based on GIT changes.
- As part of Stage 1, the code will be pulled into the workspace.
- In “Static Code Analysis” stage, the code will be analyzed for any violations of best code practices and anti-patterns usage. If this stage is the success it proceeds with the build stage. After each stage completion either success or failure, the notification will be sent to Slack channel.
- As part of the build stage, we will create APIGEE API proxy bundle.
- In the Deploy stage, I used APIGEE management APIS to deploy the API proxy bundle.
- Once the deployment is successful, then the integration tests will be triggered. I used Newman to do integration tests. Newman requires integration tests collection file as input. The test cases can be created easily with Postman
- In all the stages the notifications will be triggered to Slack channel.
There are some enhancements which I will do in the coming days. Below are some of the changes which I will target as enhancements.
- Adding email, Hipchat notifications
- Revert the API proxy to a previous revision if the integration tests fail.
- If integration tests success, promote build to load test environment and run load test scripts.
The setup and project used as part of this article are available on GitHub. Till then, Spread love for APIs!!!