-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathJenkinsfile
122 lines (120 loc) · 3.2 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
pipeline {
agent {
kubernetes {
label 'xtext-build-pod'
defaultContainer 'jnlp'
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: jnlp
volumeMounts:
- mountPath: /home/jenkins/.ssh
name: volume-known-hosts
- name: xtext-buildenv
image: docker.io/smoht/xtext-buildenv:0.7
tty: true
resources:
limits:
memory: "2Gi"
cpu: "1"
requests:
memory: "2Gi"
cpu: "1"
volumeMounts:
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
volumes:
- name: volume-known-hosts
configMap:
name: known-hosts
'''
}
}
options {
buildDiscarder(logRotator(numToKeepStr:'3'))
disableConcurrentBuilds()
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage ('Checkout') {
steps {
sshagent(['github-bot-ssh']) { //
sh '''
rm -rf deploy-xtext-git-repo
git clone -b master git@github.com:eclipse-xtext/xtext-website-publish.git deploy-xtext-git-repo
'''
}
// sshagent(['git.eclipse.org-bot-ssh']) { //
// sh '''
// rm -rf deploy-xtend-git-repo
// git clone -b master ssh://genie.xtext@git.eclipse.org:29418/www.eclipse.org/xtend deploy-xtend-git-repo
// '''
// }
}
}
stage('Generate site') {
steps {
container('xtext-buildenv') {
echo 'Building..'
dir ('git-repo/xtext-website') {
sh '''
# generate things in _site
bundle exec jekyll build
'''
}
dir ('git-repo/xtend-website') {
sh '''
# generate things in _site
bundle exec jekyll build --destination ../xtext-website/_site/xtend
'''
}
}
}
}
stage('Commit changes') {
steps {
dir ('deploy-xtext-git-repo') {
sh '''
git config user.name "genie-xtext"
git config user.email "xtext-bot@eclipse.org"
cp -r $WORKSPACE/git-repo/xtext-website/_site/* .
git diff
git add --all :/ && git commit -m "Generated from commit: https://github.com/eclipse-xtext/xtext-website/commit/$GIT_COMMIT"
git status
'''
}
// dir ('deploy-xtend-git-repo') {
// sh '''
// git config user.name "genie-xtext"
// git config user.email "xtext-bot@eclipse.org"
// cp -r $WORKSPACE/git-repo/xtend-website/_site/* .
// git diff
// git add --all :/ && git commit -m "Generated from commit: https://github.com/eclipse/xtext/commit/$GIT_COMMIT"
// git status
// '''
// }
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
dir ('deploy-xtext-git-repo') {
sshagent(['github-bot-ssh']) { //
sh '''
git push origin master
'''
}
}
// dir ('deploy-xtend-git-repo') {
// sshagent(['git.eclipse.org-bot-ssh']) { //
// sh '''
// git push origin master
// '''
// }
// }
}
}
}
}