forked from grahamar/simple-scala-generator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
63 lines (58 loc) · 1.52 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
properties([pipelineTriggers([githubPush()])])
pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '3'))
timeout(time: 30, unit: 'MINUTES')
}
agent {
kubernetes {
label 'worker-simple-scala-generator'
inheritFrom 'default'
containerTemplates([
containerTemplate(
name: 'sbt',
image: 'gcr.io/aylien-production/sbt-jdk11',
alwaysPullImage: true,
privileged: true,
ttyEnabled: true
)
])
}
}
stages {
stage('Checkout') {
steps {
checkoutWithTags scm
}
}
stage('Test') {
when { allOf { not { branch 'master' }; expression { return env.CHANGE_ID != null } } }
steps {
container('sbt') {
withCredentials([string(credentialsId: "jenkins-hub-api-token", variable: "GITHUB_TOKEN")]) {
script {
sh('SBT_OPTS="-Xmx1G" sbt clean test')
}
}
}
script {
currentBuild.result = 'SUCCESS'
}
step([$class: 'CompareCoverageAction', publishResultAs: 'statusCheck', scmVars: [GIT_URL: env.GIT_URL]])
}
}
stage('Publish') {
when { branch 'master' }
steps {
container('sbt') {
withCredentials([string(credentialsId: "jenkins-hub-api-token", variable: "GITHUB_TOKEN")]) {
script {
sh('sbt clean publish')
}
}
}
}
}
}
}