pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

Fix removal of existing cloudrun revision tags when deploying

Open niladrix719 opened this issue 7 months ago • 4 comments

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

Screenshot 2025-05-29 at 7 19 43 PM

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 avatar May 29 '25 14:05 niladrix719

@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.

github-actions[bot] avatar May 29 '25 14:05 github-actions[bot]

/check-commit f944fdff91e0f94d15656571aa3dc07df9b40949c4e8e8850fbf09d3a301d105

niladrix719 avatar May 29 '25 15:05 niladrix719

@niladrix719 Hi, Thank you so much.

At first, I recommend you split into functions and add tests.

t-kikuc avatar May 30 '25 02:05 t-kikuc

Test cases and splitting function are done. Let me know if there is anything else

niladrix719 avatar Jun 03 '25 09:06 niladrix719

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.

github-actions[bot] avatar Aug 12 '25 00:08 github-actions[bot]

Let's me hold this one and try add this while implementing the CloudRun plugin 👀

khanhtc1202 avatar Aug 13 '25 05:08 khanhtc1202

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.

github-actions[bot] avatar Sep 13 '25 00:09 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity. Feel free to reopen if still applicable.

github-actions[bot] avatar Sep 20 '25 00:09 github-actions[bot]