-
Notifications
You must be signed in to change notification settings - Fork 13
/
centos_ci.sh
71 lines (59 loc) · 2.2 KB
/
centos_ci.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
#!/bin/bash
# Output command before executing
set -x
# Exit on error
set -e
# Source environment variables of the jenkins slave
# that might interest this worker.
if [ -e "jenkins-env" ]; then
cat jenkins-env \
| grep -E "(JENKINS_URL|GIT_BRANCH|GIT_COMMIT|BUILD_NUMBER|ghprbSourceBranch|ghprbActualCommit|BUILD_URL|ghprbPullId|CICO_API_KEY)=" \
| sed 's/^/export /g' \
> ~/.jenkins-env
source ~/.jenkins-env
fi
# We need to disable selinux for now, XXX
/usr/sbin/setenforce 0
# Enable extra packages
yum --enablerepo=extras install -y epel-release
# Get all the deps in
yum -y install \
make \
git \
epel-release \
curl \
docker \
kvm \
qemu-kvm \
libvirt \
python2-pip \
python-requests
# Start docker
systemctl start docker
# Start Libvirt
systemctl start libvirtd
# Install KVM driver
curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm > /usr/local/bin/docker-machine-driver-kvm && \
chmod +x /usr/local/bin/docker-machine-driver-kvm
# Prepare ISO for testing
make iso
# Run tests
make test
# On reaching successfully at this point, upload artifacts
PASS=$(echo $CICO_API_KEY | cut -d'-' -f1-2)
rm -rf build/bin # Don't upload bin folder
set +x
# For PR build, GIT_BRANCH is set to branch name other than origin/master
if [[ "$GIT_BRANCH" = "origin/master" ]]; then
# http://stackoverflow.com/a/22908437/1120530; Using --relative as --rsync-path not working
mkdir -p minishift-b2d-iso/master/$BUILD_NUMBER/
cp build/* minishift-b2d-iso/master/$BUILD_NUMBER/
RSYNC_PASSWORD=$PASS rsync -a --delete --relative minishift-b2d-iso/master/$BUILD_NUMBER/ [email protected]::minishift/
echo "Find Artifacts here http://artifacts.ci.centos.org/minishift/minishift-b2d-iso/master/$BUILD_NUMBER ."
else
# http://stackoverflow.com/a/22908437/1120530; Using --relative as --rsync-path not working
mkdir -p minishift-b2d-iso/pr/$ghprbPullId/
cp build/* minishift-b2d-iso/pr/$ghprbPullId/
RSYNC_PASSWORD=$PASS rsync -a --delete --relative minishift-b2d-iso/pr/$ghprbPullId/ [email protected]::minishift/
echo "Find Artifacts here http://artifacts.ci.centos.org/minishift/minishift-b2d-iso/pr/$ghprbPullId ."
fi