Fix streams quickstart in Jenkinsfile
@@ -50,10 +50,7 @@ def doStreamsArchetype() {
|| { echo 'Could not install kafka-streams.jar (and dependencies) locally`'; exit 1; }
'''
- sh '''
- version=`grep "^version=" gradle.properties | cut -d= -f 2` \
- || { echo 'Could not get version from `gradle.properties`'; exit 1; }
- '''
+ VERSION = sh(script: 'grep "^version=" gradle.properties | cut -d= -f 2', returnStdout: true).trim()
dir('streams/quickstart') {
sh '''
@@ -61,23 +58,20 @@ def doStreamsArchetype() {
|| { echo 'Could not `mvn install` streams quickstart archetype'; exit 1; }
'''
- sh '''
- mkdir test-streams-archetype && cd test-streams-archetype \
- || { echo 'Could not create test directory for stream quickstart archetype'; exit 1; }
- '''
-
- sh '''
+ dir('test-streams-archetype') {
+ // Note the double quotes for variable interpolation
+ sh """
echo "Y" | mvn archetype:generate \
-DarchetypeCatalog=local \
-DarchetypeGroupId=org.apache.kafka \
-DarchetypeArtifactId=streams-quickstart-java \
- -DarchetypeVersion=$version \
+ -DarchetypeVersion=${VERSION} \
-DgroupId=streams.examples \
-DartifactId=streams.examples \
-Dversion=0.1 \
-Dpackage=myapps \
|| { echo 'Could not create new project using streams quickstart archetype'; exit 1; }
- '''
+ """
dir('streams.examples') {
sh '''
@@ -87,6 +81,7 @@ def doStreamsArchetype() {
}
}
}
+}
def tryStreamsArchetype() {
try {
