-
Notifications
You must be signed in to change notification settings - Fork 8
/
prow-test-docker.sh
executable file
·80 lines (62 loc) · 1.85 KB
/
prow-test-docker.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
set -u
set -x
##
# Set the test mode:
# - local, test with packages from COS bucket
# - staging, test from the docker's staging download website
# - release, form docker's official public download website
##
TEST_MODE="${1:-staging}"
echo "TEST_MODE=${TEST_MODE}"
if [[ "$TEST_MODE" != "local" && "$TEST_MODE" != "staging" && "$TEST_MODE" != "release" ]]; then
echo "Usage: local | staging | release"
exit 2
fi
# Path to the scripts
SECONDS=0
PATH_SCRIPTS="/home/prow/go/src/github.com/${REPO_OWNER}/${REPO_NAME}"
if [[ -z ${ARTIFACTS} ]]
then
ARTIFACTS=/logs/artifacts
echo "Setting ARTIFACTS to ${ARTIFACTS}"
mkdir -p ${ARTIFACTS}
fi
export PATH_SCRIPTS
echo "Prow Job to test docker and containerd packages from the staging"
# Go to the workdir
cd /workspace
# Start the dockerd and wait for it to start
echo "* Starting dockerd and waiting for it *"
${PATH_SCRIPTS}/dockerctl.sh start
# Get the env file and the dockertest repo and the latest built of containerd if we don't want to build containerd
echo "** Set up (env files) **"
${PATH_SCRIPTS}/get-env.sh
${PATH_SCRIPTS}/get-env-containerd.sh
set -o allexport
source env.list
source date.list
export DATE
# Test the packages
echo "*** * Calling test.sh ${TEST_MODE} * ***"
bash -x ${PATH_SCRIPTS}/test.sh ${TEST_MODE}
# Check if there are errors in the tests : NOERR or ERR
echo "*** ** Tests check ** ***"
${PATH_SCRIPTS}/check-tests.sh ${TEST_MODE}
CHECK_TESTS_BOOL=`echo $?`
echo "Exit code check : ${CHECK_TESTS_BOOL}"
echo "The tests results : ${CHECK_TESTS_BOOL}"
export CHECK_TESTS_BOOL
duration=$SECONDS
echo "DURATION ALL : $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
#Stop the dockerd
echo "* Stopping dockerd *"
${PATH_SCRIPTS}/dockerctl.sh stop
if [[ ${CHECK_TESTS_BOOL} -eq 0 ]]
then
echo "NO ERROR"
exit 0
else
echo "ERROR"
exit 1
fi