-
-
Notifications
You must be signed in to change notification settings - Fork 850
4696 bug discord alert on update uses the old version not the new one #4854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dgibbs64
wants to merge
11
commits into
develop
Choose a base branch
from
4696-bug-discord-alert-on-update-uses-the-old-version-not-the-new-one
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cfa873c
feat: refactor update comparison output for consistency and clarity
dgibbs64 bdfc6e5
Refactor remote build version handling across multiple modules
dgibbs64 9c36976
fix(alert): resolve issue with servername not always being listed in …
dgibbs64 4d0d110
fix(alert_discord): remove "More info" field from Discord alert JSON
dgibbs64 6580b89
fix(alert): improve update alert messaging for clarity
dgibbs64 24183e7
Merge branch 'develop' into 4696-bug-discord-alert-on-update-uses-the…
dgibbs64 7abedc4
remove inline
dgibbs64 c707de8
fix(alert): Correct grammar in update alert message
dgibbs64 e5026a8
typo
dgibbs64 ee1dca9
fix(alert_discord): Add inline property to "Is my Game Server Online?…
dgibbs64 7db6735
fix(pd): increase timeout for termbin.com connection
dgibbs64 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| disable=SC2154 | ||
| disable=SC2154,SC2034 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,9 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" | |
| # Generates alert log of the details at the time of the alert. | ||
| # Used with email alerts. | ||
| fn_alert_log() { | ||
| info_distro.sh | ||
| info_game.sh | ||
| info_messages.sh | ||
| if [ -f "${alertlog}" ]; then | ||
| rm -f "${alertlog:?}" | ||
| fi | ||
|
|
||
| { | ||
| fn_info_messages_head | ||
| fn_info_messages_distro | ||
|
|
@@ -97,45 +93,66 @@ fn_alert_monitor_query() { | |
|
|
||
| # Update alerts | ||
| fn_alert_update() { | ||
| fn_script_log_info "Sending alert: ${selfname} has received a game server update: ${localbuild}" | ||
| # If previousbuild is set show transition, else fallback to single version. | ||
| if [ -n "${previousbuild:-}" ] && [ -n "${localbuild:-}" ]; then | ||
| fn_script_log_info "Sending alert: ${selfname} updated: ${previousbuild} -> ${localbuild}" | ||
| alertmessage="${selfname} updated: ${previousbuild} -> ${localbuild}." | ||
| else | ||
| fn_script_log_info "Sending alert: ${selfname} updated to ${localbuild}" | ||
| alertmessage="${selfname} updated to ${localbuild}." | ||
| fi | ||
| alertaction="Updated" | ||
| alertemoji="🎉" | ||
| alertsound="1" | ||
| alertmessage="${selfname} has received a game server update: ${localbuild}." | ||
| # Green | ||
| alertcolourhex="#00cd00" | ||
| alertcolourdec="52480" | ||
| } | ||
|
|
||
| fn_alert_update_request() { | ||
| fn_script_log_info "Sending alert: ${selfname} has requested an update and needs to be restarted." | ||
| alertaction="Updating" | ||
| # Update failure alert | ||
| fn_alert_update_failed() { | ||
| # Expect updatefailureexpected (target version) and updatefailuregot (actual localbuild) if set | ||
| local updateexpected="${updatefailureexpected:-${remotebuild:-unknown}}" | ||
| local updategot="${updatefailuregot:-${localbuild:-unknown}}" | ||
| fn_script_log_error "Sending alert: ${selfname} update failed: expected ${updateexpected}, got ${updategot}" | ||
| alertaction="Update Failed" | ||
| alertemoji="❌" | ||
| alertsound="2" | ||
| alertmessage="${selfname} update failed: expected ${updateexpected}, got ${updategot}. Manual intervention required." | ||
| # Red | ||
| alertcolourhex="#cd0000" | ||
| alertcolourdec="13434880" | ||
| } | ||
|
|
||
| fn_alert_update_restart_request() { | ||
| fn_script_log_info "Sending alert: ${selfname} restart requested" | ||
| alertaction="Restart Requested" | ||
| alertemoji="🎉" | ||
| alertsound="1" | ||
| alertmessage="${selfname} has requested an update and needs to be restarted." | ||
| alertmessage="${selfname} has requested a restart for an update to be applied. Restarting now." | ||
| # Blue | ||
| alertcolourhex="#1e90ff" | ||
| alertcolourdec="2003199" | ||
| } | ||
|
|
||
| fn_alert_check_update() { | ||
| fn_script_log_info "Sending alert: ${gamename} update available: ${remotebuildversion}" | ||
| alertaction="Update available" | ||
| fn_script_log_info "Sending alert: ${gamename} update available: ${localbuild} -> ${remotebuild}" | ||
| alertaction="Update Available" | ||
| alertemoji="🎉" | ||
| alertsound="1" | ||
| alertmessage="${gamename} update available: ${remotebuildversion}" | ||
| alertmessage="${gamename} update available: ${localbuild} -> ${remotebuild}" | ||
| # Blue | ||
| alertcolourhex="#1e90ff" | ||
| alertcolourdec="2003199" | ||
| } | ||
|
|
||
| fn_alert_update_linuxgsm() { | ||
| fn_script_log_info "Sending alert: ${selfname} has received an LinuxGSM update" | ||
| fn_script_log_info "Sending alert: ${selfname} has received a LinuxGSM update" | ||
|
||
| alertaction="Updated" | ||
| alertemoji="🎉" | ||
| alertsound="1" | ||
| alertbody="${gamename} update available" | ||
| alertmessage="${selfname} has received an LinuxGSM update and been restarted." | ||
| alertmessage="${selfname} has received a LinuxGSM update and been restarted." | ||
| # Green | ||
| alertcolourhex="#00cd00" | ||
| alertcolourdec="52480" | ||
|
|
@@ -197,8 +214,9 @@ fn_alert_info() { | |
| alertcolourdec="2003199" | ||
| } | ||
|
|
||
| # Images | ||
| alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/gameicons/${shortname}-icon.png" | ||
| info_distro.sh | ||
| info_game.sh | ||
| info_messages.sh | ||
|
|
||
| if [ "${alert}" == "permissions" ]; then | ||
| fn_alert_permissions | ||
|
|
@@ -210,8 +228,10 @@ elif [ "${alert}" == "test" ]; then | |
| fn_alert_test | ||
| elif [ "${alert}" == "update" ]; then | ||
| fn_alert_update | ||
| elif [ "${alert}" == "update-request" ]; then | ||
| fn_alert_update_request | ||
| elif [ "${alert}" == "update-failed" ]; then | ||
| fn_alert_update_failed | ||
| elif [ "${alert}" == "update-restart-request" ]; then | ||
| fn_alert_update_restart_request | ||
| elif [ "${alert}" == "check-update" ]; then | ||
| fn_alert_check_update | ||
| elif [ "${alert}" == "config" ]; then | ||
|
|
@@ -237,6 +257,7 @@ else | |
| fi | ||
|
|
||
| alerttitle="${alertemoji} ${alertaction} - ${servername} ${alertemoji}" | ||
| alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/gameicons/${shortname}-icon.png" | ||
|
|
||
| # Generate alert log. | ||
| fn_alert_log | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shellcheck disable directive
SC2034has been added globally. SC2034 warns about unused variables. Adding this globally will suppress warnings about all unused variables across the entire codebase, which could hide legitimate issues. Consider adding inline# shellcheck disable=SC2034comments only where needed (e.g., wherepreviousbuildis intentionally set for later use) rather than disabling it globally.