-
Notifications
You must be signed in to change notification settings - Fork 2
/
runJenkins.sh
executable file
·58 lines (47 loc) · 1.43 KB
/
runJenkins.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
#!/usr/bin/env bash
# abort this script if any command fail
set -e
# pipe sequence will result with exit code of last *failed* subcommand
set -o pipefail
# print every command
#set -x
script_name="$0"
function log {
echo -e "[$script_name] $1"
}
function downloadIfMissing {
sourceUrl="$1"
targetFile="$2"
if [ ! -f $targetFile ]; then
log "Downloading $sourceUrl ..."
wget "$sourceUrl" -O "$targetFile"
fi
}
jenkinsWar="./jenkins.war"
jenkinsHome="./jenkins_home"
pluginsDir="${jenkinsHome}/plugins"
mkdir -p ${pluginsDir}
function downloadJenkins {
jenkinsVersion="$1"
jenkinsDownloadUrl="http://mirrors.jenkins-ci.org/war/${jenkinsVersion}/jenkins.war"
downloadIfMissing ${jenkinsDownloadUrl} ${jenkinsWar}
}
function downloadPlugin {
pluginName="$1"
pluginVersion="$2"
pluginDownloadUrl="http://updates.jenkins-ci.org/download/plugins/${pluginName}/${pluginVersion}/${pluginName}.hpi"
pluginHpi="${pluginsDir}/${pluginName}.hpi"
downloadIfMissing ${pluginDownloadUrl} ${pluginHpi}
}
downloadJenkins 1.645
downloadPlugin credentials 1.24
downloadPlugin job-dsl 1.42
downloadPlugin greenballs 1.15
downloadPlugin scm-api 1.0
downloadPlugin git-client 1.19.0
downloadPlugin git 2.4.1
downloadPlugin slack 1.8.1
downloadPlugin nodejs 0.2.1
log "Starting Jenkins on http://localhost:8080/ with home directory set to $jenkinsHome ..."
export JENKINS_HOME="$jenkinsHome"
java -jar ${jenkinsWar}