-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathJenkinsfile
More file actions
58 lines (58 loc) · 2.07 KB
/
Jenkinsfile
File metadata and controls
58 lines (58 loc) · 2.07 KB
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
pipeline {
agent none
options {
disableConcurrentBuilds()
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
}
stages {
stage('Build for PR') {
agent {
label 'Worker&&Containers'
}
when {
beforeAgent true
changeRequest()
}
steps {
script {
env.GEN_ENV = 'production'
docker.image('quay.io/hibernate/awestruct-build-env:latest').inside('--pull always') {
sh "rake setup && rake clean[all] gen[${env.GEN_ENV}]"
}
}
}
}
stage('Build and deploy') {
agent {
label 'Release'
}
when {
beforeAgent true
anyOf { branch 'production'; branch 'staging' }
not { changeRequest() }
}
stages {
stage('Build') {
steps {
script {
docker.image('quay.io/hibernate/awestruct-build-env:latest').inside('--pull always') {
sh "rake setup && rake clean[all] gen[${env.BRANCH_NAME}]"
}
}
}
}
stage('Deploy') {
steps {
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
// Need an SSH agent to have the key available when pushing to GitHub.
sshagent(['ed25519.Hibernate-CI.github.com']) {
sh "_scripts/publish-to-${env.BRANCH_NAME}.sh"
}
}
}
}
}
}
}
}