forked from fabric8-launcher/ngx-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cico_setup.sh
65 lines (52 loc) · 1.29 KB
/
cico_setup.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
#!/bin/bash
set -ex
load_jenkins_vars() {
if [ -e "jenkins-env" ]; then
cat jenkins-env \
| grep -E "(DEVSHIFT_TAG_LEN|DEVSHIFT_USERNAME|DEVSHIFT_PASSWORD|JENKINS_URL|GIT_BRANCH|GIT_COMMIT|BUILD_NUMBER|ghprbSourceBranch|ghprbActualCommit|BUILD_URL|ghprbPullId|RECOMMENDER_API_TOKEN|NPM_TOKEN|GH_TOKEN)=" \
| sed 's/^/export /g' \
> ~/.jenkins-env
source ~/.jenkins-env
echo "CICO: Jenkins environment variables loaded"
fi
}
prep() {
yum -y update
yum -y install docker make git gcc-c++ bzip2 fontconfig
curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
yum -y install nodejs
}
install_dependencies() {
# Build fabric8-analytics-stack-reports-ui
npm install;
chmod +x /root/payload/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
if [ $? -eq 0 ]; then
echo 'CICO: npm install : OK'
else
echo 'CICO: npm install : FAIL'
exit 1
fi
}
run_unit_tests() {
# Exec unit tests
npm run test:unit
if [ $? -eq 0 ]; then
echo 'CICO: unit tests OK'
else
echo 'CICO: unit tests FAIL'
exit 2
fi
}
build_project() {
# run build
npm run build
if [ $? -eq 0 ]; then
echo 'CICO: build OK'
else
echo 'CICO: build FAIL'
exit 1
fi
}
. cico_release.sh
load_jenkins_vars
prep