-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·60 lines (50 loc) · 1.42 KB
/
build.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
if ! $(docker info > /dev/null 2>&1); then
echo "Unable to access docker. (Not running or no permissions?)";
echo "For more help see: https://docs.docker.com/engine/install/linux-postinstall/";
exit 1;
fi
reload_runner=false
reload_tests=false
tests_branch="v2.1.0"
has_tests_branch=false
test_runner_commit="v2.2.0"
image_tag="v2.1.0"
argument_count=0
for var in "$@"; do
if [ $has_tests_branch = true ]; then
tests_branch="$var"
has_tests_branch=false
fi
if [[ "$var" != --* ]]; then
if [[ "$argument_count" -eq 0 ]]; then
test_runner_commit="$var"
argument_count=1
elif [[ "$argument_count" -eq 1 ]]; then
image_tag="$var"
argument_count=2
fi
fi
if [ "$var" == "--reload-runner" ]; then
reload_runner=true
elif [ "$var" == "--reload-tests" ]; then
reload_tests=true
elif [ "$var" == "--tests-branch" ]; then
has_tests_branch=true
fi
done
args=""
if [ ! -d "cache" ]; then
mkdir cache
fi
touch cache/runner-rev.txt
touch cache/tests-rev.txt
if [ $reload_runner = true ]; then
#args="$args --build-arg runner-rev=\"$(date | sed "s/ //g")\""
date >> cache/runner-rev.txt
fi
if [ $reload_tests = true ]; then
#args="$args --build-arg tests-rev=\"$(date | sed "s/ //g")\""
date >> cache/tests-rev.txt
fi
docker build --network="host" --build-arg commit=$test_runner_commit --build-arg testsbranch="$tests_branch" $args -t dpctf:$image_tag .