forked from gravitee-io/gravitee-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
40 lines (34 loc) · 1.19 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
node() {
try {
sh "rm -rf *"
stage("Checkout") {
checkout scm
}
stage("Jekyll Build") {
sh "docker build -t gravitee.io/jekyll -f Dockerfile-build ."
sh "docker run --rm -v '${env.WORKSPACE}:/src' gravitee.io/jekyll build"
}
stage("Docker Build & Push") {
sh "docker build -t graviteeio/docs:latest --pull=true ."
sh "docker push graviteeio/docs:latest"
}
stage("Restart docs container") {
sh "docker stop docs"
sh "docker rm docs"
sh "docker run -d --name docs graviteeio/docs:latest"
}
stage("Clean") {
sh "docker run --rm -v '${env.WORKSPACE}:/src' gravitee.io/jekyll clean"
}
} catch (e) {
currentBuild.result = "FAILED"
sh "git log --format=short -n1 HEAD > GIT_LOG"
def git_log = readFile encoding: 'UTF-8', file: 'GIT_LOG'
slackSend (
color: '#FF0000',
message: ":poop: ${env.JOB_NAME} " +
"<${env.BUILD_URL}console|[#${env.BUILD_NUMBER}]>\n\r" +
"```${git_log}```")
throw e
}
}