Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
#2 Enable choice of test target (profile) in Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Jun 8, 2020
1 parent 9ac5061 commit dd48273
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ pipeline {
buildDiscarder(logRotator(numToKeepStr: '5', daysToKeepStr: '5'))
}

parameters {
choice(
name: "testTarget",
choices: "latest\ntesting",
description: "Set the DukeCon target environment for testing"
)
}

triggers {
pollSCM('*/3 * * * *')
}

stages {
stage('API Test') {
steps {
sh "mvn clean test"
sh "mvn ${mvnProfile(params.testTarget)} clean test"
}
}
}
Expand All @@ -36,3 +44,10 @@ pipeline {
}
}
}

def mvnProfile(testTarget) {
if ("latest" != testTarget) {
return "-P ${testTarget}"
}
return ""
}

0 comments on commit dd48273

Please sign in to comment.