Search code examples
wso2-api-manager

Deployment pipeline with API Manager


I am building a test pipeline with API Manager with the cli tool. Development gateway will develop the api and test. QA gateway will QA and if all good, deploy it in production. To deploy api in 3 gateways i am using api cli tool. But everytime i import and deploy with cli tool, i can't deploy it in gateway without creating a new revision? I changed the deployment_environments file with gateway, but it create a new revision.

Is there a way to deploy in QA, production with the same revision?


Solution

  • First of all, this is not a recommended pipeline for CICD. Instead of using the same server with multiple gateways for different environments such as Test,QA and Prod, you should have separate deployments for each environment. Then use the APICTL and the CICD pipeline to propagate API/application artifacts across these environments.

    To answer your question, if you want to deploy the same revision in multiple gateways and looking for a flag or command in the apictl, unfortunately this is not supported. APICTL tool is built for CICD operations and not as an alternative for the publisher UI. Some user interactions such as this available in the UI does not available in the APICTL.

    Using the APICTL, you can deploy a revision in multiple gateways simultaneously by updating the deployment_environments.yaml. Deployment happens with the import operation and If you want to deploy the same API in another gateway, you need to update the deployment_environments.yaml and import it again. This will create a new revision, undeploy the previous revision from the gateways and deploy the new revision in previous gateways plus the new gateway. You don't need to manually perform these but this is what happens underneath when you import and API with deployment_environments.yaml.