Skip to content

Fix removal of existing cloudrun revision tags when deploying#5900

Closed
niladrix719 wants to merge 7 commits into
pipe-cd:masterfrom
niladrix719:cloudrun-rev-tag#4954
Closed

Fix removal of existing cloudrun revision tags when deploying#5900
niladrix719 wants to merge 7 commits into
pipe-cd:masterfrom
niladrix719:cloudrun-rev-tag#4954

Conversation

@niladrix719

@niladrix719 niladrix719 commented May 29, 2025

Copy link
Copy Markdown
Member

I have investigated about the problem,

svc = run.NewNamespacesServicesService(c.client)
name = makeCloudRunServiceName(c.projectID, sm.Name)
call = svc.ReplaceService(name, svcCfg)

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.

traffics := []provider.RevisionTraffic{
{
RevisionName: revision,
Percent: options.Percent.Int(),
},
{
RevisionName: lastDeployedRevision,
Percent: 100 - options.Percent.Int(),
},
}

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

Signed-off-by: “niladrix719” <niladrix719@gmail.com>
@niladrix719
niladrix719 requested a review from a team as a code owner May 29, 2025 14:43
@github-actions

Copy link
Copy Markdown
Contributor

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

@niladrix719 niladrix719 changed the title Fix removal of existing cloudrun revision tags Fix removal of existing cloudrun revision tags when deploying May 29, 2025
@niladrix719

niladrix719 commented May 29, 2025

Copy link
Copy Markdown
Member Author

/check-commit f944fdff91e0f94d15656571aa3dc07df9b40949c4e8e8850fbf09d3a301d105

@t-kikuc

t-kikuc commented May 30, 2025

Copy link
Copy Markdown
Member

@niladrix719
Hi, Thank you so much.

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

niladrix719 and others added 2 commits May 30, 2025 12:44
@niladrix719

Copy link
Copy Markdown
Member Author

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

@github-actions

Copy link
Copy Markdown
Contributor

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.

@khanhtc1202

Copy link
Copy Markdown
Member

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

@github-actions

Copy link
Copy Markdown
Contributor

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 github-actions Bot added the Stale label Sep 13, 2025
@github-actions

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tags Assigned to Existing Revisions are Removed when Deploying CloudRun with PipeCD

3 participants