forked from jenkins-infra/pipeline-steps-doc-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
89 lines (83 loc) · 3.16 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
#!/usr/bin/env groovy
pipeline {
// This build requires at least 8Gb of memory
agent {
label 'linux-amd64'
}
triggers {
cron('H H * * 0')
}
options {
timestamps()
timeout(time: 1, unit: 'HOURS')
skipDefaultCheckout true
}
stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}
stage('Indexer') {
steps {
dir('pluginFolder') {
git changelog: false,
poll: false,
url:'https://github.com/jenkinsci/backend-extension-indexer.git',
branch: 'master'
script {
infra.runMaven(['clean', 'install', '-DskipTests'], 17)
}
withEnv(['JAVA_HOME=/opt/jdk-17','PATH+JDK21=/opt/jdk-17/bin']) {
sh 'java -XshowSettings:vm -jar ./target/*-bin/extension-indexer*.jar -plugins ./plugins && mv plugins ..'
}
}
}
}
stage('Generator') {
steps {
dir('docFolder') {
checkout scm
script {
infra.runMaven(['clean', 'install', '-DskipTests'], 17)
}
withEnv(['JAVA_HOME=/opt/jdk-17','PATH+JDK21=/opt/jdk-17/bin']) {
sh 'mv ../plugins . && java -XshowSettings:vm -jar ./target/*-bin/pipeline-steps-doc-generator*.jar'
}
}
}
}
stage('Publisher') {
steps {
dir('docFolder') {
// allAscii and declarative must not include directory name in their zip files
sh '''
( cd allAscii && zip -r -1 -q ../allAscii.zip . )
( cd declarative && zip -r -1 -q ../declarative.zip . )
'''
script {
if (env.BRANCH_IS_PRIMARY && infra.isInfra()) {
infra.publishReports(['allAscii.zip', 'declarative.zip'])
} else {
// On branches and PR or not infra, archive the files
archiveArtifacts artifacts: 'allAscii.zip,declarative.zip', fingerprint: true
}
def result = sh returnStatus: true, script: './test-the-generated-docs.sh'
if (result != 0) {
if (result < 125) {
def message = "Test failed: error code ${result}"
currentBuild.description = message
unstable message
} else {
// Error code 125 is used by git bisect to skip a commit
// Test script returns 125 in case of unexpected exit
error "Build failed with error ${result}"
}
}
}
}
}
}
}
}