Skip to content

Conversation

@alexef
Copy link
Member

@alexef alexef commented Feb 13, 2025

a rollback initiated from the UI shouldn't remove syncOptions if they are set.

note: this is only an issue in the UI, because the UI will first disable auto-sync, then rolllback. during the auto sync disabling, the syncOptions are accidentally removed. if the rollback is initiated via CLI, then this code preserves existing sync options.

fixes: #20183

Steps to reproduce for tester

  1. create an Application, set spec.syncPolicy.syncOptions to anything, for instance: [ "CreateNamespace=true" ]
  2. enable auto-sync (set the spec.syncPolicy.automated to an object)
  3. deploy it twice at two different versions, so that you have a version to rollback to in the "History and Rollback" dialogue
  4. rollback.
  5. check spec.syncPolicy.syncOptions to still have your settings at point 1.

Before this PR, the syncOptions will be gone. After it, they would be preserved.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

a rollback initiatiated from the UI shouldn't wipe out syncOptions if set

Signed-off-by: Alex Eftimie <[email protected]>
@alexef alexef requested a review from a team as a code owner February 13, 2025 10:48
@bunnyshell
Copy link

bunnyshell bot commented Feb 13, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@alexef alexef added ready-for-review An approver should give a final review and merge the PR size/XS labels Feb 14, 2025
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

Copy link
Contributor

@todaywasawesome todaywasawesome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test the suggestions from @linghaoSu?

…tion-details.tsx

Co-authored-by: Linghao Su <[email protected]>
Signed-off-by: Alex Eftimie <[email protected]>
if (needDisableRollback) {
const update = JSON.parse(JSON.stringify(application)) as appModels.Application;
update.spec.syncPolicy = {automated: null};
update.spec.syncPolicy.automated = null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point in code (see needDisableRollback) we know that update.spec.syncPolicy.automated is set to something not null. this is why we can set it to null, while leaving the rest of syncPolicy (syncOptions) unchanged.

@alexef alexef changed the title fix: #20183 preserve syncOptions when rolling back fix: #20183 preserve syncOptions when rolling back from the UI Mar 24, 2025
@alexef
Copy link
Member Author

alexef commented Mar 24, 2025

I've updated the PR description with testing instructions. also raised it here

Copy link
Member

@linghaoSu linghaoSu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexef
Copy link
Member Author

alexef commented Mar 25, 2025

@ishitasequeira any chance this can be merged 🙏 ?

@agaudreault agaudreault merged commit 6bee96c into argoproj:master Apr 2, 2025
28 of 31 checks passed
@github-project-automation github-project-automation bot moved this from Ready for final review to Done in Argo CD Review Apr 2, 2025
@alexef alexef added the bug Something isn't working label Apr 2, 2025
@alexef
Copy link
Member Author

alexef commented Apr 2, 2025

/cherry-pick 2.14

@alexef alexef deleted the patch-3 branch April 2, 2025 13:35
Hapshanko pushed a commit to Hapshanko/argo-cd that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready-for-review An approver should give a final review and merge the PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Rollback in Argo CD Removes ServerSideApply=true from syncPolicy Configuration

5 participants