Adding shared flows to a proxy automatically

We have a requirement where we have to add shared flows to a proxy automatically via the CI/CD pipeline.

The requirement is to have some groups / flavours of shared flows stored in a repository or shared location. These are to be picked by the CI/CD pipeline as per the API definition. The API definition is currently being converted into a proxy, and the shared flows should be chosen by the pipeline according to the requirement and added to the proxy in apigee.

We have explored Flowhooks, but Flowhooks allow addition of a single shared flow only at a pre/post target/proxy endpoint level. And it adds it to all the proxies in the organization. So it will not work for this requirement.

Any leads will be helpful. Thanks!

0 7 624
7 REPLIES 7

Not applicable

Hi,

To add shared flow in your proxy you need to use flow callout policy. This is as simple as you can inject one policy to your api according to your requirement. Hope this will help you.

@Aishwarya Kozhisherry

Multiple ways to do this

1. As suggested by Priyadarshi, you can add the flow callout policy xml snippet by editing your api proxy code in the CI/CD steps.

2. You can define the place holders in your proxy code and use the maven proxy dependency plugin to replace the steps with actual flow fragments in your CI/CD. You can check details here

@Nagashree B

We already have a flow callout on Edge for sharedflows. And we have explore the maven proxy dependency plugin as well to replace the flow fragments with the flow callouts. This was done locally and not via CI/CD as of now.

But the question is, the placeholder that determines where the flow fragment will be replaced by the flow callout piece of code, has to be entered into the proxy code manually. Also, in one API this could be at line #28 and in another API, this could be at line #50. In the CI/CD pipeline, how to achieve adding different sharedflows at different places in the proxy code without any manual intervention - not even for adding the flowfragment placeholder within the proxy.xml?

@Aishwarya Kozhisherry can you provide more details on adding the shared flow . If you want to add a single shared flow to the proxy or multiple at different flows ?

@Latheef

we want to add multiple sharedflows. Basically a flavour which is like FC-1, FC-2, FC-3, and another is FC-2, FC-4, FC-6. So based on some manual input, the pipeline should be able to pick the right group of sharedflows and plug them into the proxy automatically.

So while using the proxy-depdendency-maven-plugin, we have the limitations mentioned above.

@Aishwarya Kozhisherry

For your requirement, you should handle this customization in your CI/CD pipeline by editing the proxy XML files, to add these flow callouts based on the inputs to the pipeline on which flow callouts should be added and the position or the sequencing in the flows.

From your previous posts, I presume you are using azure devops pipelines. You can achieve the XML creation/manipulation using powershell tasks in azure devops.

@Nagashree B Thanks Nagashree! Am exploring the XML editing via the pipeline now. As you have mentioned we are trying to see the best way to get the manual input, as without the manual input there is no way for the pipeline to know where the FC needs to be placed within the default.xml.