--- /dev/null
+#!/usr/bin/env python3
+
+import sys
+import json
+import urllib3
+
+project = sys.argv[1]
+url = sys.argv[2]
+version = sys.argv[3]
+
+def post(url, data):
+ urllib3.disable_warnings()
+ http = urllib3.PoolManager()
+
+ encoded = data.encode('utf-8')
+
+ r = http.request("POST", url,
+ headers={'Content-Type': 'application/json'},
+ body=encoded)
+
+data = {
+ "icon_url": "https://learn.puppet.com/static/images/logos/Puppet-Logo-Mark-Amber.png",
+ "text": "Deployed {} on {}".format(version, project),
+ }
+
+json_data = json.dumps(data)
+post(url, json_data)
$cf_bot_app_conf = "${cf_home}/bot_config.ini"
$cf_bot_app_reports = "${cf_home}/bot_reports"
+ $cf_webhook_url = lookup("cryptoportfolio::slack_webhook") |$key| { "" }
+
file { "/var/lib/postgres/data/certs":
ensure => directory,
mode => "0700",
password => '!!',
}
+ file { "/usr/local/bin/slack-notify":
+ mode => "0755",
+ source => "puppet:///modules/role/cryptoportfolio/slack-notify.py",
+ }
+
$front_version = lookup("cryptoportfolio::front_version") |$key| { {} }
$front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} }
Archive["${cf_home}/trader_${bot_version}.tar.gz"]
],
}
+
+ unless empty($cf_webhook_url) {
+ exec { "bot-slack-notify":
+ refreshonly => true,
+ command => "/usr/local/bin/slack-notify Trader '${cf_webhook_url}' '${bot_version}'",
+ require => File["/usr/local/bin/slack-notify"],
+ subscribe => Exec["py-cryptoportfolio-dependencies"],
+ }
+ }
}
# FIXME: restore backup
command => "/usr/bin/make static ENV=${cf_env}",
refreshonly => true,
}
+
+ unless empty($cf_webhook_url) {
+ exec { "front-slack-notify":
+ refreshonly => true,
+ command => "/usr/local/bin/slack-notify Front '${cf_webhook_url}' '${front_version}'",
+ require => File["/usr/local/bin/slack-notify"],
+ subscribe => [Exec["go-cryptoportfolio-app"], Exec["web-cryptoportfolio-build"]],
+ }
+ }
}
}