-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile
75 lines (71 loc) · 3.11 KB
/
Jenkinsfile
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
pipeline {
agent { label 'master' }
parameters {
booleanParam(name: 'UI', defaultValue: true)
string(name: 'Box', defaultValue: 'default', description: 'Vagrant Box')
string(name: 'HOOT_UI_AWS_ENV_TAG', defaultValue: 'testing')
string(name: 'HOOT_UI_AWS_USE_TAG', defaultValue: 'jenkins')
string(name: 'HOOT_UI_AWS_GROUP_TAG', defaultValue: 'devops')
}
environment {
HOOT_UI_AWS_ENV_TAG="${params.HOOT_UI_AWS_ENV_TAG}"
HOOT_UI_AWS_USE_TAG="${params.HOOT_UI_AWS_USE_TAG}"
HOOT_UI_AWS_GROUP_TAG="${params.HOOT_UI_AWS_GROUP_TAG}"
}
stages {
stage("Setup") {
steps {
// Attempt to destroy exiting VM but don't stop job if not there
sh "vagrant destroy -f ${params.Box} || true"
}
}
stage("Vagrant Up") {
steps {
// TODO: Vagrant up --noprovision, install hoot from daily develop RPMs
sh "vagrant up ${params.Box} --provider aws"
sh "vagrant ssh ${params.Box} -c 'sudo yum install -y epel-release yum-utils git bzip2'"
sh "vagrant ssh ${params.Box} -c 'sudo yum-config-manager --add-repo https://hoot-repo.s3.amazonaws.com/el7/pgdg13.repo'"
sh "vagrant ssh ${params.Box} -c 'sudo yum-config-manager --add-repo https://geoint-deps.s3.amazonaws.com/el7/stable/geoint-deps.repo'"
sh "vagrant ssh ${params.Box} -c 'sudo yum-config-manager --add-repo https://hoot-repo.s3.amazonaws.com/el7/master/hoot.repo'"
sh "vagrant ssh ${params.Box} -c 'sudo yum makecache -y'"
sh "vagrant ssh ${params.Box} -c 'sudo yum install -y hootenanny-core'"
sh "vagrant ssh ${params.Box} -c 'sudo yum install -y hootenanny-services-ui'"
sh "vagrant ssh ${params.Box} -c 'sudo yum install -y hootenanny-autostart'"
sh "vagrant ssh ${params.Box} -c 'sudo yum install -y google-chrome-stable-91.0.4472.114'"
sh "vagrant ssh ${params.Box} -c '/var/lib/hootenanny/scripts/database/AddKarmaTestUser.sh;'"
sh "vagrant ssh ${params.Box} -c '/var/lib/hootenanny/scripts/chrome/driver-install.sh;'"
}
}
stage("UI") {
when {
expression { return params.UI }
}
steps {
// Build ui-2x
sh "vagrant ssh ${params.Box} -c 'cd hoot-ui; npm i; npm run production'"
// Run ui-2x tests
sh "vagrant ssh ${params.Box} -c 'cd hoot-ui; npm test'"
}
}
}
post {
aborted {
script {
notifySlack("ABORTED", "#builds_hoot-ui")
}
}
success {
script {
notifySlack("SUCCESS", "#builds_hoot-ui")
// If all tests passed, clean everything up
sh "vagrant destroy -f ${params.Box}"
cleanWs()
}
}
failure {
script {
notifySlack("FAILURE", "#builds_hoot-ui")
}
}
}
}