Last active
December 15, 2023 14:36
-
-
Save locnnil/b233038dce3aa031b14e13a9d82783ce to your computer and use it in GitHub Desktop.
Reserve and poll a system on Testflinger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
declare -A COLOR | |
COLOR['END']='\033[0m' | |
COLOR['RED']='\033[0;31m' | |
if [ "$#" -ne 1 ]; then | |
echo -e "${COLOR['RED']}[ERROR] You must provide one and only one argument:${COLOR['END']}" >&2 | |
echo -e "${COLOR['RED']}1. The path to the job.yaml file\n${COLOR['END']}" >&2 | |
exit 1 | |
fi | |
logger=out_$(date +%Y%m%d%H%M%S).log; \ | |
testflinger submit $1 | \ | |
tee $logger | \ | |
grep -o '[a-f0-9]\{8\}-[a-f0-9]\{4\}-[a-f0-9]\{4\}-[a-f0-9]\{4\}-[a-f0-9]\{12\}' | \ | |
xargs -I {} testflinger poll {} | \ | |
tee -a $logger | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment