[BUG] Deleting objects in the git repository does not delete it from APIM
Release version
6.0.1.7
Describe the bug
When deleting objects like API's or Subscriptions in the Git Repository, we removed the definitons from git repository. The expected behavior is for apiops to remove the objects from apim after running the publisher pipeline, but it does not remove and objects stay in apim
Expected behavior
The expected behavior is for apiops to remove the objects from apim after running the publisher pipeline,
Actual behavior
The objects continue to be on apim and no deletion happens, leaving environment in inconsistent state
Reproduction Steps
- Delete an API/Subscription in Git repository
- Run publisher pipeline
- Validate if the deletion happened, i see objects continue to be on apim after that
Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.
I think your issue is the same as in #774 , which I will close. In both cases, sounds like you're not passing the commit ID to the publisher.
The publisher looks for a configuration value called COMMIT_ID. If there's one, it will only publish changes in that commit. If there isn't, it will deploy the full repository as-is. Our starter pipelines show examples for ADO and GitHub.
It is not linked to #774 these are two different scenarios. Do I manually need to paas commit ID? I am passing the commit ID as provided in the example?
As for deletion, when we delete API's in git repository, it does not remove it from APIM. Irrespective of all commits or last commits also
Update of discussion, the commit_id is not being passed. While selecting "publish-artifact-in-last-commit"
We are able to see commit id in get commit job,
but the actual step that runs in the pipeline is "run-publisher-without-commit-id"
At this point, debug logs show, commit ID to be empty
I have encountered the same behaviour.
When deleting any configurations from the git repository like namedValues, Subscriptions, Backends or APIs, the expected behaviour would be that the Publisher removes any configurations from APIM which are not present in the git repository (because they were just removed). However, the Publisher just publishes anything in the git repository but does not remove anyting.
The logs of the Publisher shows that it reaches the 'removal' logic because for every configuration property it logs that it removing 0 configurations from APIM ( see screenshot below).
From my point of view, this is a crucial part of Azure APIOPS because I cannot trust APIOPS anymore that the configuration in my git repository is 'a mirror' of the configuration in Azure APIM.
Could any of the developers take a look at this?
Thanks in advance!