Skip to content

Conversation

@tangboxuan
Copy link
Contributor

The previous checkResourceStatus function was not very readable as it listed each combination of watch options for health, and this PR aims to simplify and improve the readability of the heath checks in checkResourceStatus function.

@tangboxuan tangboxuan requested a review from a team as a code owner December 19, 2024 16:24
@bunnyshell
Copy link

bunnyshell bot commented Dec 19, 2024

❗ Preview Environment undeploy from Bunnyshell failed

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to try again to remove the environment

Copy link
Member

@terrytangyuan terrytangyuan 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 fix the typo in the PR title?

@tangboxuan tangboxuan changed the title chore: Improve checkResrouceStatus readability chore: Improve checkResourceStatus readability Dec 23, 2024
Signed-off-by: Boxuan Tang <[email protected]>
@codecov
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@8398380). Learn more about missing BASE report.
⚠️ Report is 458 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #21260   +/-   ##
=========================================
  Coverage          ?   60.07%           
=========================================
  Files             ?      343           
  Lines             ?    57848           
  Branches          ?        0           
=========================================
  Hits              ?    34750           
  Misses            ?    20328           
  Partials          ?     2770           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}
} else {
healthCheckPassed = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be more Go-style to init the variable as true and avoid else block this way.

Copy link
Member

@reggie-k reggie-k left a comment

Choose a reason for hiding this comment

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

Thanks for improving this code! LGTM with addressing Andrii's comment.

return false
}

healthBeingChecked := watch.suspended || watch.health || watch.degraded
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't have to init the variable and can just put a condition inline. But it's a small thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I thought it would be more readable that way as it is more obvious that the code is determining if one of the health conditions is being checked. Also happy to inline it if others feel differently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Idk, this way works too.

@andrii-korotkov-verkada andrii-korotkov-verkada added the ready-for-review An approver should give a final review and merge the PR label Dec 30, 2024
Signed-off-by: Alexandre Gaudreault <[email protected]>
@agaudreault agaudreault changed the title chore: Improve checkResourceStatus readability refactor: Improve checkResourceStatus readability May 15, 2025
@agaudreault agaudreault enabled auto-merge (squash) May 15, 2025 13:33
@agaudreault agaudreault changed the title refactor: Improve checkResourceStatus readability chore: Improve checkResourceStatus readability May 15, 2025
@agaudreault agaudreault merged commit 2e4d8e5 into argoproj:master May 15, 2025
27 of 28 checks passed
ranakan19 pushed a commit to ranakan19/argo-cd that referenced this pull request May 20, 2025
Signed-off-by: Boxuan Tang <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Kanika Rana <[email protected]>
olivergondza pushed a commit to olivergondza/argo-cd that referenced this pull request May 20, 2025
Signed-off-by: Boxuan Tang <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Oliver Gondža <[email protected]>
chansuke pushed a commit to chansuke/argo-cd that referenced this pull request Jun 4, 2025
Signed-off-by: Boxuan Tang <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
dsuhinin pushed a commit to dsuhinin/argo-cd that referenced this pull request Jun 16, 2025
Signed-off-by: Boxuan Tang <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: dsuhinin <[email protected]>
dsuhinin pushed a commit to dsuhinin/argo-cd that referenced this pull request Jun 16, 2025
Signed-off-by: Boxuan Tang <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: dsuhinin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

5 participants