Skip to content

Commit

Permalink
WIP: Add a kola verb
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Sep 18, 2018
1 parent be83d27 commit 00c953a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/cmd-kola
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -xeuo pipefail

dn=$(dirname $0)
. ${dn}/cmdlib.sh

latest_qcow=$(get_latest_qcow)
if [ -z "${latest_qcow}" ]; then
fatal "No latest build"
fi

exec sudo kola -b rhcos --tapfile test.tap --qemu-image ${latest_qcow} run rhcos.basic
9 changes: 5 additions & 4 deletions src/cmd-run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

set -euo pipefail

dn=$(dirname $0)
. ${dn}/cmdlib.sh

VM_DISK=
VM_MEMORY=2048
VM_PERSIST=0
Expand Down Expand Up @@ -71,10 +74,8 @@ while [ $# -ge 1 ]; do
done

if [ -z "${VM_DISK}" ]; then
if [ -L ./builds/latest ]; then
latest_build=$(readlink builds/latest)
VM_DISK=$(ls builds/${latest_build}/*-qemu.qcow2)
else
VM_DISK=$(get_latest_qcow)
if [ -z "${VM_DISK}" ]; then
die "No builds/latest, and no -d argument provided"
fi
fi
Expand Down
13 changes: 13 additions & 0 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,16 @@ runcompose() {
sudo rpm-ostree compose tree --repo=${workdir}/repo-build --cachedir=${workdir}/cache ${treecompose_args} \
${TREECOMPOSE_FLAGS:-} ${manifest} "$@"
}

get_latest_build() {
if [ -L builds/latest ]; then
readlink builds/latest
fi
}

get_latest_qcow() {
local latest=$(get_latest_build)
if [ -n "$latest" ]; then
ls builds/${latest}/*-qemu.qcow2
fi
}

0 comments on commit 00c953a

Please sign in to comment.