[BUG] Product for multiple APIs are not getting deployed through publisher pipeline
Release version
v4.1.0
Describe the bug
in my DEV environment, few APIs are associated with the same "product" when I am doing the deployment for higher environment, its considering only the given API in "artifact folder" and in target environment, others APIs not showing up to connect with this product.
Please see the atta
ched image of dev environment where product "cxp" is associated with multiple APIs
See the attached image for QA when we deployed the APIs
then in QA, under this product only one API is displaying
Expected behavior
like dev, in QA also under the product all associated APIS should be displayed
Actual behavior
in QA, under product only one API is displaying
Reproduction Steps
if needed I can attach the config file here.
Hi @nehaapr28 - this behavior is expected.
If you tell ApiOps to only export specific APIs, the extractor will only extract product/api associations that contain the listed APIs.
When the publisher then runs, it sets the product API association to what's defined in the extracted JSON. That means APIs not associated with a product in code will be removed from the product in APIM.
I can see why this behavior is not ideal. We'll discuss internally whether it should change. Keep in mind though, the ApiOps philosophy has Git as the source of truth. Our tool is designed to make your environment mirror what's represented in code.
This issue just happened in a scenario with more than 100 API's losing their product - almost a disaster if it wouldn't have been noticed on TEST already. I know the gitops philosophy here, but unless I explicitly delete something (on commit level) I don't want things to be removed. One simple and logical alternative could be to switch the API Products assignments to API level and not on product level.
+1! I had a similar close-call as @DSpirit last week and I'm now struggling to figure out how to manage the APIs within the Product for upper environments.
I think there's a pattern of usage (which i believe was suggested by MS to the team i work with) where we have one API per-branch. This definitely breaks this, because the product.json file in one branch is considered to have the complete set of APIs assigned to a product, and it performs a replace, not a merge. We've somewhat solved this by having a separate "Product" branch where the product-API mapping is extracted to. This, of course, is now a cyclical dependency, which is it's own - but more manageable - drag.
Thanks for the feedback. After internal deliberations, we've landed on this approach.
Current behavior
- Product APIs are stored in
products/productA/apis.json, whereapis.jsonlooks like
[
{
"name": "apiA"
},
{
"name": "apiB"
}
]
- If
products/productA/apis.jsonwas modified in the commit, the publisher- Associates APIs in
apis.jsonwith the product. In the example above,apiAandapiBwill get associated withproductA. - Removes any associations to the product for APIs that are NOT in
apis.json. In the example above, ifapiCis currently associated withproductA, that association is removed.
- Associates APIs in
New behavior
- Product APIs are stored in
products/productA/apis/apiA/fileNameTBD.json.fileNameTBD.jsonwill be an empty JSON object for now. - When the publisher runs
- If
products/productA/apis/apiA/fileNameTBD.jsonwas added in the Git commit,apiAis associated withproductA. - If
products/productA/apis/apiA/fileNameTBD.jsonwas deleted in the Git commit, the association is removed.
- If
This is a BREAKING CHANGE, but the behavior will be more consistent with that of other ApiOps resources. Would love to hear any feedback.
@trdrake-tw - Could you elaborate on your scenario? We've seen ApiOps used with various branching strategies, but one API per branch can get unwieldy very quickly.
I would agree, but it's the approach we've been asked to take. @mihirsurting, in the linked issue (https://github.com/Azure/apiops/issues/295), might could comment.
This is a problem for teams with operator repositories because APIs have to be deployed before the products can be deployed. It forces this:
-
deploy the operators repo: resources like namevalues
-
deploy the api repo: with no product
-
deploy the operator repo again: product with an api assignment This requires a costly ceremony to release new APIs and products that we don't have to do with other resources that deploy like this:
-
deploy the operators repo: * service-level resources
-
deploy the api repo: with the product assignment
While I understand it may make more sense to match the management API in terms of maintainability, the consumer of APIOps doesn't use the management API. We consume the APIOps tools. I will say it is painful to remember and teach my team "it works one way unless it's a product, then you have to do a special thing."
@guythetechie do you have any news about that?
Hi @guythetechie,
How long will take to release this feature, I can see it's been under review since the 30th of April,
Thanks, Regards
we just tested under v6.0.0-rc1 and the issue has been resolved. Please test and let us know.
I have to associate products with Apis in APIOps and using "APIOps Toolkit for Azure APIM v6.0.1.1" latest version hoping it contains fix for this issue and Product APIs are being stored in /artifacts/products/productName/apis/apiName/productApiInformation.json. After running publisher it's successful but products don't get associate with Apis.Can someone share the fix if this has been resolved and does v6.0.1.1 contain fix for this issue?
guys, please provide a quality fix..... you delivered a feature that is not even doing what is suppose to do,
we have a global product definition repo where we don't want to extract apis but only products that will have all associated apis, but that is not happening, so we manually entering the json spec in product to keep this working...