Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Ferroin
Copy link
Member

@Ferroin Ferroin commented Oct 13, 2025

Summary

The current check is relatively naive and only compares the installed version of Netdata against the latest published release and the version that was reported prior to the update. Long term we should probably improve it, but for now this is good enough to clearly report the inability to update.

Test Plan

n/a

The current check is relatively naive and only compares the installed
version of Netdata against the latest published release. Long term we
should probably improve it, but for now this is good enough to clearly
report the inability to update.
@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Oct 13, 2025
This avoids the most likely case of false positives (updating while
we’re in the process of publishing a new version).
@Ferroin Ferroin marked this pull request as ready for review October 14, 2025 11:09
@Ferroin Ferroin requested a review from a team as a code owner October 14, 2025 11:09
@Ferroin Ferroin requested a review from a team October 31, 2025 12:52
@ilyam8 ilyam8 requested a review from Copilot October 31, 2025 12:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the version checking logic in the netdata-updater script by extracting helper functions for better code organization and reusability. It also adds validation for binary package updates to detect when the package manager fails to update Netdata despite not reporting an error.

  • Extracted get_latest_tag(), get_current_version(), and get_latest_version() as separate helper functions
  • Added post-update verification for binary package installations to detect incomplete updates
  • Updated the error code counter to U001E
Comments suppressed due to low confidence (2)

packaging/installer/netdata-updater.sh:820

  • The variable latest_tag is undefined in this scope after the refactoring. The old update_available() function previously set this variable from get_latest_version(), but the refactored version no longer does. Line 820 should call get_latest_tag() instead: latest_major=\"$(echo \"$(get_latest_tag)\" | cut -f 1 -d '.' | tr -d 'v')\"
      current_major="$(${ndbinary} -v | cut -f 2 -d ' ' | cut -f 1 -d '.' | tr -d 'v')"
      latest_major="$(echo "${latest_tag}" | cut -f 1 -d '.' | tr -d 'v')"

packaging/installer/netdata-updater.sh:819

  • The variable ndbinary is undefined in this scope. After refactoring, get_current_version() sets ndbinary as a local variable, but update_available() attempts to use it. Either ndbinary should be exported from get_current_version() or line 819 should be changed to re-execute the netdata binary lookup or extract the major version from the current version information.
      current_major="$(${ndbinary} -v | cut -f 2 -d ' ' | cut -f 1 -d '.' | tr -d 'v')"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

error ""
error "A newer version of Netdata is available, but the system package manager does not appear to have updated to that version."
error ""
error "Most likely, your system is not up to date, and you have it configured in a way that prevents updating Netdata from updating any of Netdata's dependencies."
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The phrase 'prevents updating Netdata from updating' contains redundant wording. It should be 'prevents Netdata from updating' or 'prevents the updater from updating'.

Suggested change
error "Most likely, your system is not up to date, and you have it configured in a way that prevents updating Netdata from updating any of Netdata's dependencies."
error "Most likely, your system is not up to date, and you have it configured in a way that prevents Netdata or any of Netdata's dependencies from updating."

Copilot uses AI. Check for mistakes.
error "Please try updating your system manually and then re-running the Netdata updater before reporting an issue with the update process."
error ""
fatal "Package manager did not fully update Netdata despite not reporting a failure." U001D
exit 1
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The exit 1 statement on line 1189 is unreachable because fatal terminates the script. This line should be removed as it serves no purpose and adds confusion.

Suggested change
exit 1

Copilot uses AI. Check for mistakes.
@thiagoftsm
Copy link
Contributor

Hello @Ferroin ,

Please, take a look in copilot suggestions.

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

Labels

area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants