ctf-tools/bin/ctf-tools-test-action
Michael Rodler ec75e3d081 Updated Dockerfiles, added script to quickly run manage-tools in a container for testing
* Dockerfile updates
    * Ubuntus now use apt-get-install wrapper to not leave package lists in the container
    * Copy uncommited manage-tools, etc. scripts into container, which
      is good for manual testing.
    * Remove dependency on virtualenvwrapper for Ubuntus and Fedora
* `ctf-tools-test-action` to quickly test something for another distribution in a docker container, e.g.
  `ctf-tools-test-action -d fedora -s -v reinstall qemu`
2018-04-20 11:12:52 -07:00

41 lines
861 B
Bash
Executable file

#!/bin/bash -e
function usage()
{
cat <<END
Usage: $(basename $0) [-d distribution] <manage-tools parameters...>
Run a manage-tools actions inside of a docker container, with the current
ctf-tools repository mounted into the container. This is primarily useful for
testing uncommited changes to a tool.
END
}
CTFTOOLS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../"
DOCKER_DIST=""
DOCKER_CONTAINER="ctftools${DOCKER_DIST}"
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
if [[ "$1" == "-d" ]]; then
DOCKER_DIST=".$2"
shift 2
fi
pushd $CTFTOOLS_DIR >/dev/null
set -x
sudo docker build \
-t "$DOCKER_CONTAINER" \
-f "Dockerfile${DOCKER_DIST}" \
.
sudo docker run --rm -it \
-v $CTFTOOLS_DIR:/home/ctf/tools:z \
"$DOCKER_CONTAINER" bash -c "/home/ctf/tools/bin/manage-tools $*"
exit $?