forked from galasa-dev/managers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.documentation
90 lines (85 loc) · 2.96 KB
/
Jenkinsfile.documentation
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
def mvnProfile = 'dev,managerdocs'
pipeline {
// Initially run on any agent
agent {
label 'github'
}
options { timestamps () }
environment {
//Configure Maven from the maven tooling in Jenkins
def mvnHome = tool 'Default'
PATH = "${mvnHome}/bin:${env.PATH}"
//Set some defaults
def workspace = pwd()
def mvnGoal = 'install'
}
stages {
// for debugging purposes
stage('report') {
steps {
echo "Branch/Tag : ${env.GIT_BRANCH}"
echo "Commit Hash : ${env.GIT_COMMIT}"
echo "Workspace directory: ${workspace}"
echo "Maven profile : ${mvnProfile}"
echo "Doc Branch : ${env.DOC_BRANCH}"
echo "Doc Reviewers : ${env.DOC_REVIEWERS}"
echo "Doc User : ${env.DOC_USER}"
echo "Doc Email : ${env.DOC_EMAIL}"
}
}
// Set up the workspace, clear the git directories and setup the maven settings.xml files
stage('prep-workspace') {
steps {
configFileProvider([configFile(fileId: '86dde059-684b-4300-b595-64e83c2dd217', targetLocation: 'settings.xml')]) {
}
dir('repository/dev.galasa') {
deleteDir()
}
dir('repository/dev/galasa') {
deleteDir()
}
}
}
stage('Clone Docs') {
steps {
dir('galasa.dev') {
deleteDir()
}
sh 'mkdir galasa.dev'
dir('galasa.dev') {
git(url: 'git@github.com:galasa-dev/galasa.dev.git', branch: "next")
sh "git checkout -b ${env.DOC_BRANCH}"
}
}
}
stage('Extract Javadoc') {
steps {
dir('galasa-managers-parent') {
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -P ${mvnProfile} -B -e -fae clean process-sources"
}
}
}
stage('Generate Markdown') {
steps {
dir('galasa-managers-parent') {
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -Dgalasa.manager.doc.directory=${workspace}/galasa.dev/src/markdown-pages/docs/managers -P ${mvnProfile} -B -e -fae dev.galasa:galasautils-maven-plugin:0.8.0:buildmanagerdoc"
}
}
}
stage('Create Pull Request') {
steps {
withCredentials([string(credentialsId: 'c4c96c90-6635-4813-ae7f-abfa889a96b6', variable: 'GITHUB_TOKEN')]) {
dir('galasa.dev') {
sh "${workspace}/githubdocs.sh"
}
}
}
}
}
post {
// triggered when red sign
failure {
slackSend (channel: '#project-galasa-devs', color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}