Skip to content

Commit 364fddf

Browse files
committed
Update Jenkinsfile with latest buildPlugin PR version.
1 parent 50153bc commit 364fddf

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

Jenkinsfile

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def configurations = [
55

66
def params = [
77
failFast: false,
8-
pit: true,
8+
pit: [skip: false],
99
configurations: configurations,
1010
checkstyle: [qualityGates: [[threshold: 1, type: 'NEW', unstable: true]]],
1111
pmd: [qualityGates: [[threshold: 1, type: 'NEW', unstable: true]]],
@@ -148,9 +148,10 @@ def params = [
148148
mavenOptions += '-DskipTests'
149149
}
150150
mavenOptions += 'clean install'
151-
def pit = params.containsKey('pit') ? params.pit : false
152-
if (pit && first) {
153-
mavenOptions += ' org.pitest:pitest-maven:mutationCoverage'
151+
def pit = params?.pit as Map ?: [:]
152+
def runWithPit = pit.containsKey('skip') && pit.get('skip') == true // use same convention as in tests.skip
153+
if (runWithPit && first) {
154+
mavenOptions += '-Ppit'
154155
}
155156
try {
156157
infra.runMaven(mavenOptions, jdk, null, addToolEnv, useArtifactCachingProxy)
@@ -161,17 +162,16 @@ def params = [
161162
discoverReferenceBuild()
162163
// Default configuration for JaCoCo can be overwritten using a `jacoco` parameter (map).
163164
// Configuration see: https://www.jenkins.io/doc/pipeline/steps/code-coverage-api/#recordcoverage-record-code-coverage-results
164-
Map jacocoArguments = [tools: [[parser: 'JACOCO', pattern: '**/jacoco/jacoco.xml']]]
165+
Map jacocoArguments = [tools: [[parser: 'JACOCO', pattern: '**/jacoco/jacoco.xml']], sourceCodeRetention: 'MODIFIED']
165166
if (params?.jacoco) {
166167
jacocoArguments.putAll(params.jacoco as Map)
167168
}
168169
recordCoverage jacocoArguments
169170
if (pit) {
170-
recordCoverage(
171-
tools: [[parser: 'PIT', pattern: '**/pit-reports/mutations.xml']],
172-
id: 'pit',
173-
name: 'Mutation Coverage',
174-
checksName: 'Mutation Coverage')
171+
Map pitArguments = [tools: [[parser: 'PIT', pattern: '**/pit-reports/mutations.xml']], id: 'pit', name: 'Mutation Coverage']
172+
pitArguments.putAll(pit)
173+
pitArguments.remove('skip')
174+
recordCoverage(pitArguments)
175175
}
176176
}
177177
}
@@ -281,6 +281,21 @@ def params = [
281281
if (failFast && currentBuild.result == 'UNSTABLE') {
282282
error 'Static analysis quality gates not passed; halting early'
283283
}
284+
/*
285+
* If the current build was successful, we send the commits to Launchable so that
286+
* the result can be consumed by a Launchable build in the future. We do not
287+
* attempt to record commits for non-incrementalified plugins because such
288+
* plugins' PR builds could not be consumed by anything else anyway, and all
289+
* plugins currently in the BOM are incrementalified. We do not attempt to record
290+
* commits on Windows because our Windows agents do not have Python installed.
291+
*/
292+
if (incrementals && platform != 'windows' && currentBuild.currentResult == 'SUCCESS') {
293+
launchable.install()
294+
withCredentials([string(credentialsId: 'launchable-jenkins-bom', variable: 'LAUNCHABLE_TOKEN')]) {
295+
launchable('verify')
296+
launchable('record commit')
297+
}
298+
}
284299
} else {
285300
echo "Skipping static analysis results for ${stageIdentifier}"
286301
}

0 commit comments

Comments
 (0)