Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ buildPlugin()
execute the steps against in parallel
* `jenkinsVersions`: (default: `[null]`) - a matrix of Jenkins baseline versions to build/test against in parallel (null means default,
only available for Maven projects)
* `artifactTypes`: (default: `['jpi', 'hpi']`) - List of artifact extensions to
archive

Usage:

Expand All @@ -39,6 +41,12 @@ Usage:
buildPlugin(platforms: ['linux'], jdkVersions: [7, 8])
----

.Jenkinsfile
[source,groovy]
----
buildPlugin(artifactTypes: ['jar'])
----

=== infra.isTrusted()

Determine whether the Pipeline is executing in an internal "trusted" Jenkins
Expand Down
10 changes: 8 additions & 2 deletions vars/buildPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def call(Map params = [:]) {
def jenkinsVersions = params.containsKey('jenkinsVersions') ? params.jenkinsVersions : [null]
def repo = params.containsKey('repo') ? params.repo : null
def failFast = params.containsKey('failFast') ? params.failFast : true
def artifactTypes = params.containsKey('artifactTypes') ? params.artifactTypes : ['jpi', 'hpi']
Map tasks = [failFast: failFast]
for (int i = 0; i < platforms.size(); ++i) {
for (int j = 0; j < jdkVersions.size(); ++j) {
Expand Down Expand Up @@ -88,11 +89,16 @@ def call(Map params = [:]) {
String artifacts
if (isMaven) {
testReports = '**/target/surefire-reports/**/*.xml'
artifacts = '**/target/*.hpi,**/target/*.jpi'
for(m = 0; m < artifactTypes.size(); m++) {
artifactTypes[m] = "**/target/*.${artifactTypes[m]}"
}
} else {
testReports = '**/build/test-results/**/*.xml'
artifacts = '**/build/libs/*.hpi,**/build/libs/*.jpi'
for(m = 0; m < artifactTypes.size(); m++) {
artifactTypes[m] = "**/build/libs/*.${artifactTypes[m]}"
}
}
artifacts = String.join(',', artifactTypes)

junit testReports // TODO do this in a finally-block so we capture all test results even if one branch aborts early
if (failFast && currentBuild.result == 'UNSTABLE') {
Expand Down