Skip to content

Commit

Permalink
Add a kola verb
Browse files Browse the repository at this point in the history
This is the first place we're wrapping mantle via our
main entrypoint, and hopefully we'll increase that.

For now we hardcode `-b rhcos`...but that should change.

Example usage: `coreos-assembler kola run rhcos.basic`.

Requires: coreos/mantle#920
  • Loading branch information
cgwalters committed Sep 21, 2018
1 parent 79e493f commit c38a300
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} "$@"
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 @@ -92,3 +92,16 @@ runcompose() {
${TREECOMPOSE_FLAGS:-} ${manifest} "$@"
set +x
}

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 c38a300

Please sign in to comment.