-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
103 lines (87 loc) · 4.32 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
#!groovy
pipeline {
agent { node { label 'linux' } }
tools {
maven 'maven3'
}
// triggers {
// upstream(upstreamProjects: 'tck/tck-olamy-github-tck-run-module-glassfish') //, threshold: hudson.model.Result.SUCCESS)
// }
options {
buildDiscarder logRotator( numToKeepStr: '30' )
}
parameters {
string( defaultValue: 'jetty-12.0.10', description: 'GIT branch name to build Jetty (jetty-12.0.10)',
name: 'JETTY_TAG' )
string( defaultValue: 'jdk17', description: 'JDK to build Jetty', name: 'JDKBUILD' )
string( defaultValue: 'clean install -T3 -Dmaven.build.cache.enabled=false', description: 'Maven Args for jetty 9 use verify org.apache.maven.plugins:maven-javadoc-plugin:3.7.0:aggregate -DlegacyMode=true -T5', name: 'MVN_GOALS' )
string( defaultValue: '-ntp -V -B -e -DskipTests ', description: 'Extra Maven Args', name: 'MVN_ARGS' )
string( defaultValue: 'javadoc/target/apidocs', description: 'Javadoc path (for Jetty 9 use target/site/apidocs)', name: 'JAVADOC_LOCAL_PATH' )
choice( description: 'Javadoc branch',
name: 'JAVADOC_PATH',
choices: ['jetty-12','jetty-11','jetty-10','jetty-9'] )
}
stages {
stage("Checkout Jetty Sources/ Build Javadoc") {
steps {
ws('tmp') {
checkout([$class : 'GitSCM',
branches : [[name: "$JETTY_TAG"]],
extensions : [[$class: 'CloneOption', depth: 1, shallow: true, reference: "/home/jenkins/jetty.project.git"]],
userRemoteConfigs: [[url: 'https://github.com/eclipse/jetty.project.git']]])
timeout(time: 30, unit: 'MINUTES') {
withEnv(["JAVA_HOME=${tool "$JDKBUILD"}",
"PATH+MAVEN=${env.JAVA_HOME}/bin:${tool 'maven3'}/bin",
"MAVEN_OPTS=-Xms10g -Xmx10g -Djava.awt.headless=true"]) {
configFileProvider([configFile(fileId: 'oss-settings.xml', variable: 'GLOBAL_MVN_SETTINGS')]) {
sh "mvn -s $GLOBAL_MVN_SETTINGS $MVN_ARGS $MVN_GOALS"
stash includes: "$JAVADOC_LOCAL_PATH/**/*", name: "apidocs"
}
}
}
}
}
}
stage("Commit new Javadoc") {
environment {
GIT_AUTH = credentials('github-app-jetty-project')
}
steps {
sh('''
git config user.name '$GIT_AUTH_USR'
git config user.email '[email protected]'
git checkout main
''')
unstash 'apidocs'
script {
if("$JAVADOC_PATH" != 'jetty-12') {
sh('''
echo "need to update canonical because $JAVADOC_PATH"
bash ./_update_canonical_links.sh $JAVADOC_PATH
''')
} else {
sh "echo 'in jetty 12 no need to _update_canonical_links'"
}
}
sh('''
ls -lrt
ls -lrt $JAVADOC_LOCAL_PATH
cp -r $JAVADOC_LOCAL_PATH/* $JAVADOC_PATH/
rm -rf javadoc
git status
git add -A $JAVADOC_PATH/
git commit -m "update javadoc for $JETTY_TAG in path $JAVADOC_PATH"
git config --local credential.helper "!f() { echo username=\\$GIT_AUTH_USR; echo password=\\$GIT_AUTH_PSW; }; f"
git push origin main
''')
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: './',
reportFiles: 'index.html',
reportName: 'Jetty Javadoc',
reportTitles: 'Jetty Javadoc'])
}
}
}
}