-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
76 lines (69 loc) · 1.93 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
pipeline {
agent { label 'docker' }
environment {
ADJUST_USER_UID = sh(
returnStdout: true,
script: 'id -u'
).trim()
ADJUST_USER_GID = sh(
returnStdout: true,
script: 'id -g'
).trim()
ADJUST_DOCKER_GID = sh(
returnStdout: true,
script: 'getent group docker | cut -d: -f3'
).trim()
}
stages {
stage('Build') {
agent {
docker {
alwaysPull true
image 'kuralabs/flowbber:latest'
args '-u root:root --init'
}
}
environment {
GITHUB_TOKEN = credentials('GITHUB_TOKEN')
}
steps {
sh '''
sudo --user=python3 --preserve-env --set-home tox --recreate
'''
stash name: 'docs', includes: '.tox/doc/tmp/html/**/*'
}
}
stage('Publish') {
agent { label 'docs' }
when {
beforeAgent true
branch 'master'
}
steps {
unstash 'docs'
sh '''
umask 022
mkdir -p /deploy/docs/flowbber
rm -rf /deploy/docs/flowbber/*
cp -R .tox/doc/tmp/html/* /deploy/docs/flowbber/
'''
}
}
}
post {
success {
slackSend (
color: '#00FF00',
message: ":sunny: SUCCESSFUL: " +
"<${env.BUILD_URL}|[${env.BUILD_NUMBER}] ${env.JOB_NAME}>"
)
}
failure {
slackSend (
color: '#FF0000',
message: ":rain_cloud: FAILED: " +
"<${env.BUILD_URL}|[${env.BUILD_NUMBER}] ${env.JOB_NAME}>"
)
}
}
}