forked from jenkins-infra/ircbot
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
34 lines (27 loc) · 941 Bytes
/
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
#!groovy
def imageName = 'jenkinsciinfra/ircbot'
/* Only keep the 10 most recent builds. */
properties([[$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']]])
node('docker') {
checkout scm
/* Using this hack right now to grab the appropriate abbreviated SHA1 of
* our current build's commit. We must do this because right now I cannot
* refer to `env.GIT_COMMIT` in Pipeline scripts
*/
sh 'git rev-parse HEAD > GIT_COMMIT'
shortCommit = readFile('GIT_COMMIT').take(6)
def imageTag = "build${shortCommit}"
stage 'Build ircbot'
withEnv([
"BUILD_NUMBER=${env.BUILD_NUMBER}:${shortCommit}",
"JAVA_HOME=${tool 'jdk8'}",
"PATH+MVN=${tool 'mvn'}/bin",
]) {
sh 'make bot'
}
stage 'Build container'
def whale = docker.build("${imageName}:${imageTag}")
stage 'Deploy container'
whale.push()
}