Skip to content
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

[infra] feat: notify Discord role when URLs checks fail #1824

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

GresilleSiffle
Copy link
Collaborator

@GresilleSiffle GresilleSiffle commented Nov 1, 2023

related issues #1822


Description

This PR makes the external URLs monitoring script able to highlight a specific Discord role when it fails.

The goal is to explicitly and quickly notify the core team when the staging and production server are unreachable.

Checklist

  • I added the related issue(s) id in the related issues section (if any)
    • if not, delete the related issues section
  • I described my changes and my decisions in the PR description
  • I read the development guidelines of the CONTRIBUTING.md
  • The tests pass and have been updated if relevant
  • The code quality check pass

@@ -88,6 +88,9 @@ export TWBOT_ACCESS_TOKEN_EN
TWBOT_ACCESS_TOKEN_SECRET_EN=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBot\".ACCESS_TOKEN_SECRET)
export TWBOT_ACCESS_TOKEN_SECRET_EN

DISCORD_ROLE_ID_URLS_CHECKS="$(ssh "$VM_USER@$VM_ADDR" -- sudo cat /root/discord_role_id_urls_checks)"
Copy link
Collaborator Author

@GresilleSiffle GresilleSiffle Nov 1, 2023

Choose a reason for hiding this comment

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

In the current state, if /root/discord_role_id_urls_checks doesn't exist the command will fail and will stop the deployment.

If we want to keep this feature optional, we could use:

# won't fail, the error will be displayed in the stdout
sudo cat /root/discord_role_id_urls_checks || true

# won't fail, the error will be silent
sudo cat /root/discord_role_id_urls_checks 2> /dev/null || true

In theory I think that DISCORD_ROLE_ID_URLS_CHECKS should be optional, to let people deploy a Tournesol instance without being forced to use Discord alerts. Thus using 2> /dev/null could be appropriate if we don't want to display an error when an optional setting is missing.

What do you think @amatissart ?

Copy link
Member

Choose a reason for hiding this comment

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

2> /dev/null is fine.

Alternatively, I think it would be acceptable to define the variable discord_role_id_urls_checks publicly in "inventory.yml" in the tournesol-prod section.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, addressed in:

@GresilleSiffle GresilleSiffle changed the title WIP / [infra] feat: notify Discord role when URLs checks fail [infra] feat: notify Discord role when URLs checks fail Nov 1, 2023
@GresilleSiffle GresilleSiffle self-assigned this Nov 1, 2023
@GresilleSiffle GresilleSiffle marked this pull request as ready for review November 1, 2023 10:51
@GresilleSiffle GresilleSiffle merged commit a377e6e into main Nov 9, 2023
6 checks passed
@GresilleSiffle GresilleSiffle deleted the 1822-highlight_role_when_urlschecks_fail branch November 9, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants