Commit 85649320 by Fred Smith

add abbey callbacks

parent 48f867a7
......@@ -97,6 +97,13 @@ cleanup_params=""
if [[ "$cleanup" == "false" ]]; then
cleanup_params="--no-cleanup"
fi
notification_params=""
if [[ ! -z "$callback_url" ]]; then
if [[ ! -z "$jobid" ]]; then
notification_params="--callback-url $callback_url$jobid"
curl "$callback_url$jobid/starting%20abbey%20for%20$jobid"
fi
fi
cd configuration
pip install -r requirements.txt
......@@ -105,5 +112,4 @@ cd util/vpc-tools/
echo "$vars" > /var/tmp/$BUILD_ID-extra-vars.yml
cat /var/tmp/$BUILD_ID-extra-vars.yml
python -u abbey.py -p $play -t c3.large -d $deployment -e $environment -i /edx/var/jenkins/.ssh/id_rsa $base_params $blessed_params $playbookdir_params --vars /var/tmp/$BUILD_ID-extra-vars.yml -c $BUILD_NUMBER --configuration-version $configuration --configuration-secure-version $configuration_secure -k $jenkins_admin_ec2_key --configuration-secure-repo $jenkins_admin_configuration_secure_repo $configurationprivate_params $hipchat_params $cleanup_params
python -u abbey.py -p $play -t c3.large -d $deployment -e $environment -i /edx/var/jenkins/.ssh/id_rsa $base_params $blessed_params $playbookdir_params --vars /var/tmp/$BUILD_ID-extra-vars.yml -c $BUILD_NUMBER --configuration-version $configuration --configuration-secure-version $configuration_secure -k $jenkins_admin_ec2_key --configuration-secure-repo $jenkins_admin_configuration_secure_repo $configurationprivate_params $hipchat_params $cleanup_params $notification_params
......@@ -5,6 +5,7 @@ import time
import json
import yaml
import os
import requests
try:
import boto.ec2
import boto.sqs
......@@ -124,6 +125,9 @@ def parse_args():
parser.add_argument("--hipchat-api-token", required=False,
default=None,
help="The API token for Hipchat integration")
parser.add_argument("--callback-url", required=False,
default=None,
help="The callback URL to send notifications to")
parser.add_argument("--root-vol-size", required=False,
default=50,
help="The size of the root volume to use for the "
......@@ -139,7 +143,6 @@ def parse_args():
return parser.parse_args()
def get_instance_sec_group(vpc_id):
grp_details = ec2.get_all_security_groups(
......@@ -669,6 +672,9 @@ def launch_and_configure(ec2_args):
def send_hipchat_message(message):
print(message)
if args.callback_url:
r=requests.get("{}/{}".format(args.callback_url, message))
#If hipchat is configured send the details to the specified room
if args.hipchat_api_token and args.hipchat_room_id:
import hipchat
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment