diff --git a/README.md b/README.md index 634ccd8f1d8cefec880ccd0681af1dca75db224b..8ae93b2a0d524eb4868f1aee576558549cb5f15d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ * `DB_MOUNTPOINT`: Filesystem path to mount as `/dbmount`` * `FEEDS`: Comma separated list of "csets" to check from Red Hat * `INTERESTING_PACKAGES`: Name of the file that contains info about the packages we should inform about via mattermost - * `MATTERMOST_INTEGRATION_URL`: The mattermost integration url to provide updates to + * `MATTERMOST_INTEGRATION_URL_PATH`: A path that contains the mattermost integration url used for alerting Most modifications will be done to `/package_alerts/prod.packages.yml`, which is where you can set up what packages you want to keep an eye on. You can add a specific feed to watch and notes to include diff --git a/dev.variables.sh b/dev.variables.sh index c679357063c1fa52e922f40614ce685db6b65061..ac83c6aad099d1dc25ce23559aa7ee8d876c15fb 100644 --- a/dev.variables.sh +++ b/dev.variables.sh @@ -2,4 +2,4 @@ SCHEDULE="0 8 * * *" DB_MOUNTPOINT="/mnt/data2/test/package_alerts" INTERESTING_PACKAGES="dev.packages.yml" FEEDS="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,rhel-9-for-x86_64-baseos-rpms,rhel-9-for-x86_64-appstream-rpms,almalinux-8-for-x86_64-AppStream-rpms,almalinux-8-for-x86_64-BaseOS-rpms,almalinux-9-for-x86_64-AppStream-rpms,almalinux-9-for-x86_64-BaseOS-rpms" -MATTERMOST_INTEGRATION_URL="https://mattermost.web.cern.ch/hooks/cy45ecb3kpgwbm88smkn4fa43h" +MATTERMOST_INTEGRATION_URL_PATH="/etc/nomad/mm_hook_test" diff --git a/package_alerts.nomad b/package_alerts.nomad index 8acd13089cef81477ff8a069426bb3559b64ac95..89e56adea70f75e111119c10771e9b040cefd1cc 100644 --- a/package_alerts.nomad +++ b/package_alerts.nomad @@ -21,6 +21,7 @@ job "${PREFIX}_package_alerts" { } volumes = [ "${DB_MOUNTPOINT}:/work", + "${MATTERMOST_INTEGRATION_URL_PATH}:/etc/mattermost_hook_url", ] } @@ -28,7 +29,6 @@ job "${PREFIX}_package_alerts" { NOMAD_ADDR = "$NOMAD_ADDR" INTERESTING_PACKAGES = "$INTERESTING_PACKAGES" FEEDS = "$FEEDS" - MATTERMOST_INTEGRATION_URL = "$MATTERMOST_INTEGRATION_URL" RHSM_OFFLINE_TOKEN = "$RHSM_OFFLINE_TOKEN" } diff --git a/package_alerts/package_alerts b/package_alerts/package_alerts index c116e47fcdbbc41b6eb4df26876c1f922c92cab9..affe0a402314b78f88e22456da6fff0a1853c549 100755 --- a/package_alerts/package_alerts +++ b/package_alerts/package_alerts @@ -19,7 +19,12 @@ import yaml offline_token = os.getenv("RHSM_OFFLINE_TOKEN") interesting_packages_file = os.getenv("INTERESTING_PACKAGES") unformatted_feeds = os.getenv("FEEDS") -mattermost_integration_url = os.getenv("MATTERMOST_INTEGRATION_URL") + +try: + with open('/etc/mattermost_hook_url', encoding='utf-8') as f: + mattermost_integration_url = f.read() +except (FileNotFoundError, IsADirectoryError): + mattermost_integration_url = None if ( offline_token is None diff --git a/prod.variables.sh b/prod.variables.sh index 10233ef52f672c47e415ee161789e56af219a8df..456005b870f5a30a436d82ac2f4892c203ec6849 100644 --- a/prod.variables.sh +++ b/prod.variables.sh @@ -2,4 +2,4 @@ SCHEDULE="*/30 * * * *" DB_MOUNTPOINT="/mnt/data2/package_alerts" INTERESTING_PACKAGES="prod.packages.yml" FEEDS="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,rhel-9-for-x86_64-baseos-rpms,rhel-9-for-x86_64-appstream-rpms,almalinux-8-for-x86_64-AppStream-rpms,almalinux-8-for-x86_64-BaseOS-rpms,almalinux-9-for-x86_64-AppStream-rpms,almalinux-9-for-x86_64-BaseOS-rpms" -MATTERMOST_INTEGRATION_URL="https://mattermost.web.cern.ch/hooks/qiodnmzwbjg9zkyxkxoh1h47sh" +MATTERMOST_INTEGRATION_URL_PATH="/etc/nomad/mm_hook_prod"