summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/centos-regression.sh
blob: 146a6cee0afe2313d75d7b32759fb2d1ac9ce46a (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash

MY_ENV=`env | sort`
BURL=${BUILD_URL}consoleFull

# Display all environment variables in the debugging log
echo "Start time $(date)"
echo
echo "Display all environment variables"
echo "*********************************"
echo
echo "$MY_ENV"
echo


# Remove any gluster daemon leftovers from aborted runs
sudo -E bash /opt/qa/cleanup.sh

# Clean up the git repo
sudo rm -rf $WORKSPACE/.gitignore $WORKSPACE/*
sudo chown -R jenkins:jenkins $WORKSPACE
cd $WORKSPACE
git reset --hard HEAD

# Clean up other Gluster dirs
sudo rm -rf /var/lib/glusterd/* /build/install /build/scratch >/dev/null 2>&1

# Remove the many left over socket files in /var/run
sudo rm -f /var/run/????????????????????????????????.socket >/dev/null 2>&1

# Remove GlusterFS log files from previous runs
sudo rm -rf /var/log/glusterfs/* /var/log/glusterfs/.cmd_log_history >/dev/null 2>&1

JDIRS="/var/log/glusterfs /var/lib/glusterd /var/run/gluster /d /d/archived_builds /d/backends /d/build /d/logs /home/jenkins/root"
sudo mkdir -p $JDIRS
sudo chown jenkins:jenkins $JDIRS
chmod 755 $JDIRS


# Do not run tests that only modifies doc; does not consider chained changes or files in repo root
DOC_ONLY=true
for file in `git diff-tree --no-commit-id --name-only -r HEAD`; do
    if [[ $file != doc/* ]]; then
        DOC_ONLY=false
        break
    fi
done
if [[ "$DOC_ONLY" == true ]]; then
    echo "Patch only modifies doc/*. Skipping further tests"
    RET=0
    VERDICT="Skipped tests for doc only change"
    V="+1"
    ssh build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --label CentOS-regression=$V $GIT_COMMIT
    exit $RET
fi


# Skip tests for patches that make distaf only changes
# Do not run tests that only modifies distaf; does not consider chained changes or files in repo root
DISTAF_ONLY=true
for file in `git diff-tree --no-commit-id --name-only -r HEAD`; do
    if [[ $file != tests/distaf/* ]]; then
        DISTAF_ONLY=false
        break
    fi
done
if [[ "$DISTAF_ONLY" == true ]]; then
    echo "Patch only modifies tests/distaf/*. Skipping further tests"
    RET=0
    VERDICT="Skipped tests for distaf only change"
    V="+1"
    ssh build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --label CentOS-regression=$V $GIT_COMMIT
    exit $RET
fi

# Build Gluster
echo "Start time $(date)"
echo
echo "Build GlusterFS"
echo "***************"
echo
/opt/qa/build.sh
RET=$?
if [ $RET != 0 ]; then
    # Build failed, so abort early
    RET=0
    VERDICT="FAILED"
    V="-1"
    ssh build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --label CentOS-regression=$V $GIT_COMMIT
    exit $RET
fi
echo

# Run the regression test
echo "Start time $(date)"
echo
echo "Run the regression test"
echo "***********************"
echo
sudo -E bash /opt/qa/regression.sh
RET=$?
if [ $RET = 0 ]; then
    V="+1"
    VERDICT="SUCCESS"
else
    V="-1"
    VERDICT="FAILED"
fi

# Update Gerrit with the success/failure status
ssh build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --label CentOS-regression="$V"  $GIT_COMMIT
exit $RET