Skip to content

Instantly share code, notes, and snippets.

@foursixnine
Last active November 9, 2019 10:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foursixnine/b0d37109c71671303e5a874f7fdd9556 to your computer and use it in GitHub Desktop.
Save foursixnine/b0d37109c71671303e5a874f7fdd9556 to your computer and use it in GitHub Desktop.
Restart a job in an openQA instance
set -e
MICROTIME=$(date +%s);
APIKEY="APIKEY"
APISECRET="APISECRET"
APIROUTE='/api/v1/jobs/1748061/restart' # Beware if your URL has extra characters
# See https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/UserAgent.pm#L78
HMAC=$(echo -n "$APIROUTE$MICROTIME" | openssl dgst -sha1 -mac hmac -macopt key:$APISECRET | awk '{ print $2}');
curl -v \
-X POST \
-D /dev/stderr \
-H "Accept: application/json" \
-H "X-API-Microtime: $MICROTIME" \
-H "X-API-Key: $APIKEY"\
-H "X-API-Hash: $HMAC"\
http://phobos.suse.de/$APIROUTE
@foursixnine
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment