Skip to content

Instantly share code, notes, and snippets.

@locnnil
Last active December 15, 2023 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save locnnil/b233038dce3aa031b14e13a9d82783ce to your computer and use it in GitHub Desktop.
Save locnnil/b233038dce3aa031b14e13a9d82783ce to your computer and use it in GitHub Desktop.
Reserve and poll a system on Testflinger
#!/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