~samiam/MaraDNS

ref: 3.5.0021 MaraDNS/Docker-stuff/run.MaraDNS.tests -rwxr-xr-x 1.2 KiB
ca00f282 — Sam Trenholme MaraDNS release 3.5.0021 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# These two lines need to be changed before running this script;
# see README.md for details
TESTDIR="/home/user/MaraDNS-CI/" # Where we run MaraDNS tests 
IMAGE="a1b2c3d4e5f6" # ID of Docker/Podman image w/ MaraDNS test framework

# Start the test
cd $TESTDIR
if [ ! -e MaraDNS ] ; then
        git clone https://github.com/samboy/MaraDNS
fi
cd MaraDNS
git pull origin master
COMMIT="$( git log -1 | head -1 | awk '{print $2}' )"
cd ..
LAST="$( cat lastCommit )"
if [ "$LAST" = "$COMMIT" ] ; then
        echo No changes\; not running test
        exit 0
fi

# Clean up old docker images
IMGS=$( docker ps -a | grep $IMAGE | awk '{print $1}' )
if [ ! -z "$IMGS" ] ; then
        for IMG in $IMGS ; do
                docker rm $IMG
        done
fi

# Run the actual tests.  If using Jenkins instead of running this
# from cron, remove the output redirect, e.g.
# docker run -it $IMAGE /run.tests.sh
docker run $IMAGE /run.tests.sh > output-$( date +%Y-%m-%d )
# If using podman instead of real docker, we need the -it flag, e.g.
#docker run -it $IMAGE /run.tests.sh > output-$( date +%Y-%m-%d )

# Make a note of the last commit we tested against, so we do not test
# against that commit again
echo $COMMIT > lastCommit