Revision fb3f87feafd46f5c8480b300c1bcf386b699d23e authored by Alexander Kruppa on 28 May 2021, 15:28:36 UTC, committed by Alexander Kruppa on 28 May 2021, 15:29:36 UTC
1 parent 4ef6307
Raw File
50-libvirt-wrap-tests.sh
#!/bin/bash

# Usage:
# ./ci/50-libvirt-wrap-tests.sh [IMAGE NAME] [[SCRIPT]]

IMAGE_NAME="$1"
shift

. "$(dirname $0)/000-functions.sh"
. "$(dirname $0)/001-environment.sh"
. "$(dirname $0)/002-tanker.bash"
. "$(dirname $0)/003-trap-add.bash"

# if ! tanker image list | grep -q cado-nfs-"$IMAGE_NAME" ; then
    enter_section configuration "Creating base image cado-nfs-$IMAGE_NAME"
    tanker vm build -R -t cado-nfs-"$(id -n -u)"-"$IMAGE_NAME" "$IMAGE_NAME" @host "$(dirname $0)/" env "${exports[@]}" ./00-prepare-docker.sh
    leave_section
# fi

tty=()
context=./
if [ $# = 0 ] ; then
    $ECHO_E "${CSI_BLUE}Starting an interactive shell. Transporting only git archive${CSI_RESET}"
    tty+=(-t)
    tmp=$(mktemp -d /tmp/XXXXXXXXXXXXXXX)
    git archive --format=tar.gz HEAD > $tmp/git.tar.gz
    context=$tmp/git.tar.gz
    trap_add "rm -rf $tmp" EXIT
    set -- bash
fi
tanker vm run --rm "${tty[@]}" cado-nfs-"$(id -n -u)"-"$IMAGE_NAME" @host user@ "$context" env "${exports[@]}" "$@"
back to top