#!/bin/bash [ "x${GH_CONNECT}" = "x" -o "x${GH_JOBID}" = "x" ] && return 1 curl_post () { local data=$1 curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X PUT --data $data "${GH_CONNECT}" } push_prepared () { data='{"JobID":"'"${GH_JOBID}"'","Status":"1"}' curl_post $data } push_connect () { data='{"JobID":"'"${GH_JOBID}"'","Status":"2","IP":"'"${VM_ACCESS_SOCKET%:*}"'","Port":"'"${VM_ACCESS_SOCKET#*:}"'","Username":"'"${VM_ACCESS_USERNAME}"'","Password":"'"${VM_ACCESS_PASSWORD}"'"}' curl_post $data } push_failed () { msg=$1 data='{"JobID":"'"${GH_JOBID}"'","Status":"255","Error":"'"$msg"'"}' curl_post $data } push_finished () { data='{"JobID":"'"${GH_JOBID}"'","Status":"3"}' curl_post $data }