#!/bin/sh # USAGE: # # This script is run via the Drone CI/CD build on build.coopcloud.tech. # However, you can run it locally. **PLEASE BE AWARE** that this scripts # destroys resources on the swarm server you run it against. This is for # setup/teardown for the integration test suite. # # export DRONE_SOURCE_BRANCH= # ./run-ci-int set -eu echo "========================================================================" echo "WIPING DOCKER RESOURCES FOR A CLEAN SLATE" echo "========================================================================" SERVICES=$(docker service ls -q) if [ ! -z "$SERVICES" ]; then echo "Removing services..." docker service rm $SERVICES echo fi STACKS=$(docker stack ls --format "{{.Name}}") if [ ! -z "$STACKS" ]; then echo "Removing stacks..." docker stack rm --detach=false $STACKS echo fi CONTAINERS=$(docker ps -a -q) if [ ! -z "$CONTAINERS" ]; then echo "Stopping containers..." docker stop $CONTAINERS echo fi docker system prune --force --volumes --all echo "========================================================================" echo "========================================================================" echo "CLONING ABRA" echo "========================================================================" rm -rf abra git clone ssh://git@git.coopcloud.tech:2222/coop-cloud/abra.git cd abra echo "========================================================================" echo "========================================================================" echo "FETCHING ABRA BRANCH FOR TESTING" echo "========================================================================" if [ -z "$DRONE_SOURCE_BRANCH" ]; then DRONE_SOURCE_BRANCH="main" fi git fetch --all git checkout $DRONE_SOURCE_BRANCH echo "========================================================================" echo "========================================================================" echo "BUILDING ABRA" echo "========================================================================" export PATH="/usr/lib/go-1.21/bin:$PATH" make build-abra echo "========================================================================" echo "========================================================================" echo "GO VERSIONING INFO" echo "========================================================================" go version echo "========================================================================" echo "========================================================================" echo "DOCKER VERSIONING INFO" echo "========================================================================" docker version echo "========================================================================" echo "========================================================================" echo "RUNNING THE INTEGRATION TEST SUITE" echo "========================================================================" export ABRA_DIR="$HOME/.abra_test" export TERM=xterm export TEST_SERVER=default rm -rf "$ABRA_DIR" bats -Tp tests/integration --filter-tags \!dns --print-output-on-failure echo "========================================================================"