Fix removal of existing cloudrun revision tags when deploying
I have investigated about the problem, https://github.com/pipe-cd/pipecd/blob/c1ca195128301d0b12ad69971c28b8c702e7aacb/pkg/app/piped/platformprovider/cloudrun/client.go#L94-L96
The issue was that when calling svc.ReplaceService(name, svcCfg), the tags associated with revisions in the traffic configuration were being lost.
To fix this, we can retrieve the current service configuration, extracts the existing revision tags from its traffic configuration, and then copy these tags to the corresponding revisions in the new service configuration before calling ReplaceService.
But still, the tags of outdated revisions would be removed, as we are only keeping track of the new revision and the last deployed revision.
https://github.com/pipe-cd/pipecd/blob/c1ca195128301d0b12ad69971c28b8c702e7aacb/pkg/app/piped/executor/cloudrun/deploy.go#L188-L197
To solve this, we can mark the outdated revisions that have tags with 0% traffic, so it can replicate the behavior seen in Cloud Run
What this PR does:
- Fixes the removal of existing Cloud Run revision tags during deployment
- Adds tests for the new functionality
Why we need it:
Revision tags created by the user should not be removed
Which issue(s) this PR fixes:
Fixes #4954
Does this PR introduce a user-facing change?: No
- How are users affected by this change: No
- Is this breaking change: No
- How to migrate (if breaking change): No
@niladrix719
Thank you for your contribution! We look forward to seeing more from you.
Please run the make check command to ensure your changes will pass the CI.
After successfully running the command on your local machine, the instructions will be printed out.
Please follow them to commit your changes.
If the check has not passed, please fix the issues and push the changes to your branch.
Then, please run the make check command again to ensure the issues are fixed.
/check-commit f944fdff91e0f94d15656571aa3dc07df9b40949c4e8e8850fbf09d3a301d105
@niladrix719 Hi, Thank you so much.
At first, I recommend you split into functions and add tests.
Test cases and splitting function are done. Let me know if there is anything else
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Let's me hold this one and try add this while implementing the CloudRun plugin 👀
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This PR was closed because it has been stalled for 7 days with no activity. Feel free to reopen if still applicable.