-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile
57 lines (57 loc) · 2.09 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
pipeline {
agent {
label 'Worker&&Containers'
}
options {
disableConcurrentBuilds()
}
stages {
stage('Build') {
steps {
script {
if ( env.BRANCH_NAME == 'production' ) {
env.GEN_ENV = 'production'
}
else {
env.GEN_ENV = 'staging'
}
// Build the website inside a container
docker.image('quay.io/hibernate/awestruct-build-env:latest').inside('--pull always') {
sh "rake setup && rake clean[all] gen[${env.GEN_ENV}]"
}
}
}
}
stage('Deploy to staging') {
when {
beforeAgent true
branch 'staging'
not { changeRequest() }
}
steps {
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
sshagent(['jenkins.in.relation.to']) {
sh '_scripts/publish-to-staging.sh'
}
}
}
}
stage('Deploy to production') {
when {
beforeAgent true
branch 'production'
not { changeRequest() }
}
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-production.sh'
}
}
}
}
}
}