forked from Cronocide/reddit-top-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
79 lines (78 loc) · 2.13 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
76
77
78
79
#!/usr/bin/env groovy
pipeline {
agent {
label 'nomad'
}
parameters {
string(name: 'GIT_REPO_NAME', defaultValue: 'git.cronocide.net', description: 'The hostname of the git repository.')
string(name: 'USERN', defaultValue: 'cronocide', description: 'The username of the user in the git repository.')
booleanParam(name: 'PREPARE', defaultValue: true, description: 'Do preparations on this project.')
booleanParam(name: 'INSPECT', defaultValue: false, description: 'Do inspections on this project.')
booleanParam(name: 'BUILD', defaultValue: true, description: 'Do builds on this project.')
booleanParam(name: 'TEST', defaultValue: true, description: 'Do tests on this project.')
booleanParam(name: 'PUBLISH', defaultValue: true, description: 'Publish this project.')
booleanParam(name: 'DEPLOY', defaultValue: false, description: 'Deploy this project.')
}
environment {
WORKSPACE_PATH = "/opt/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}${WORKSPACE}"
DESCRIPTION = "Reddit Top RSS is a set of scripts for Reddit's API that generates RSS feeds for specified subreddits with score thresholds."
}
stages {
stage('Prepare') {
when { expression { params.PREPARE } }
steps {
withEnv(['ACTION=cicd_prepare']) {
sh ( script: './build.sh')
}
}
}
stage('Inspect') {
when { expression { params.INSPECT } }
steps {
withEnv(['ACTION=cicd_inspect']) {
sh ( script: './build.sh')
}
}
}
stage('Build') {
when { expression { params.BUILD } }
steps {
withEnv(['ACTION=cicd_build']) {
sh ( script: './build.sh')
}
}
}
stage('Test') {
when { expression { params.TEST } }
steps {
withEnv(['ACTION=cicd_test']) {
sh ( script: './build.sh')
}
}
}
stage('Publish') {
when { expression { params.PUBLISH } }
steps {
withEnv(['ACTION=cicd_publish']) {
sh ( script: './build.sh')
}
}
}
stage('Deploy') {
when { expression { params.DEPLOY } }
steps {
withEnv(['ACTION=cicd_deploy']) {
sh ( script: './build.sh')
}
}
}
}
post {
success {
echo 'Pipeline succeeded.'
}
failure {
echo 'Pipeline failed.'
}
}
}