apigee / apigee-deploy-maven-plugin

Apache License 2.0
80 stars 169 forks source link

Deploy proxies and shared flows to multiple Apigee Environments #227

Closed rohit3d2003 closed 11 months ago

rohit3d2003 commented 11 months ago

I am looking for guidance to facilitate deployment of an API Proxy & Shared Flows to multiple environments which is possible via Apigee Console. It seems the shared pom file has profiles and what I have understood is that they are related to SDLC environments. So if someone has Dev Apigee Org, dev profile is for that. Looking forward to your guidance on this.

ssvaidyanathan commented 11 months ago

@rohit3d2003 - Yes you can use Pom profiles for that. You can create different profiles for each of your environment or just leave it as is and have them parameterized

For example

<profile>
            <id>dev</id>
            <properties>
                <apigee.profile>dev</apigee.profile>
                <apigee.env>${env}</apigee.env>
                <apigee.hosturl>https://apigee.googleapis.com</apigee.hosturl>
                <apigee.apiversion>v1</apigee.apiversion>
                <apigee.org>${org}</apigee.org>
                <apigee.options>override</apigee.options>
                <apigee.bearer>${bearer}</apigee.bearer>
            </properties>
        </profile>

And then pass the values in the mvn command for example

mvn clean install -Pdev -Dorg=<org> -Denv=dev -Dbearer=$(gcloud auth print-access-token)
rohit3d2003 commented 11 months ago

@ssvaidyanathan - If you have a single repository with multiple API Proxies that are targeted for different environments, consider this scenario: Proxy A and B should be deployed to 'dev-1', while Proxy C and D should be deployed to 'dev-2'. Would you recommend using different parent POM files and, possibly, different gateway folders as well? Is this the right approach?

Also, is it necessary to loop through all the API proxy folders and deploy them one by one? Or is the plugin smart enough to automatically identify all the API proxy folders and deploy them collectively?

ssvaidyanathan commented 11 months ago

I would recommend single proxy per repo.

rohit3d2003 commented 11 months ago

I understand that's the guidance but for a larger enterprise they may want to organize multiple proxies in a single repo. If that's the case, how to best accommodate the repository structure including having multiple parent pom files so maven tool does what it is supposed to do.

ssvaidyanathan commented 11 months ago

that becomes the challenge with the mono repo.. Deployments become complex, testing becomes complex.

Lets say you have 10 proxies in your single repo. You change just one.. Will you just deploy that 1 or all? What about your automation testing? Will it run just those cases that are part of the API being changed?

All that complicates your pipeline.. Hence I recommend them a single repo per proxy. The pipeline can call other pipelines once this pipeline successfully completes

rohit3d2003 commented 11 months ago

I suppose you can determine the changes and deploy only what has been modified. Regarding testing, it also makes sense to run the entire suite. While I understand your suggestion, having a monorepo as a use case seems feasible as well. It doesn't necessarily have to be a single repository for the entire enterprise; it could be individual repositories based on business units. I would appreciate any guidance you can provide on structuring a monorepo.

ssvaidyanathan commented 11 months ago

Probably use Maven multi module to manage one parent pom with all proxies as modules and then have individual pom files for each proxy (module). Then use appropriate profile with values in each module's pom file so that when you run it from the parent project, the child poms profile gets used and then deployed

ssvaidyanathan commented 11 months ago

If this resolves your questions and is not an actual issue with the plugin, can we close this one?

rohit3d2003 commented 11 months ago

Yes, please and thank you for all the support.