-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
82 lines (82 loc) · 2.94 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
80
81
82
pipeline {
agent {
docker { image 'node:alpine' }
}
stages {
stage('build') {
// environment {
// PUB_SSH = credentials('PUB_SSH')
// }
steps {
echo 'Building...'
sh 'echo "Hello World!"'
sh '''
uname -a
date
'''
/* sh 'python --version' */ /* python not found in Alpine docker image */
/* sh 'echo "${env.PUB_SSH}"' */
// sh 'echo "$PUB_SSH"'
}
}
stage('test') {
steps {
echo 'Testing...'
timeout(time: 3, unit: 'MINUTES') {
retry(5) {
sh 'node --version'
}
}
}
}
stage('deploy (staging)') {
steps {
echo 'Deploying Staging...'
}
}
stage('sanity check') {
steps {
input "Did QA sign off on Staging?"
}
}
stage('deploy (production)') {
steps {
echo 'Deploying Production...'
}
}
}
post {
always { /* this will always run */
echo "All done! 8)"
/* collect test results and artifacts */
archive 'build/libs/**/*.jar' /* grab built artifacts for local analysis/investigation */
// hipchatSend room: 'Project Staging',
// message: "Pipeline run completed: ${currentBuild.fullDisplayName}",
// color: 'PURPLE'
}
success { /* runs when successful */
echo "Pipeline succeeded! :)"
// mail to: '[email protected]',
// subject: "Jenkins: Executed Pipeline [SUCCESS]: ${currentBuild.fullDisplayName}",
// body: "Pipeline all done: ${env.BUILD_URL}\nStatus: Succeeded\n"
// hipchatSend room: 'Project Staging',
// message: "Executed Pipeline [SUCCESS]: ${currentBuild.fullDisplayName}",
// color: 'GREEN'
}
unstable { /* runs when marked as unstable */
echo "Pipeline is unstable. :/"
}
failure { /* runs if failed */
echo "Pipeline failed! :("
// mail to: '[email protected]',
// subject: "Jenkins: Executed Pipeline [FAILED]: ${currentBuild.fullDisplayName}",
// body: "Pipeline all done: ${env.BUILD_URL}\nStatus: Failed\n"
// hipchatSend room: 'Project Staging',
// message: "Executed Pipeline [FAILED] - Job Name: ${env.JOB_NAME} - Job No. #${env.BUILD_NUMBER}",
// color: 'RED'
}
changed { /* runs if state of Pipeline has changed, e.g. previously failed, but now succeeded */
echo "Pipeline status changed. :|"
}
}
}