You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2020/09/14 14:32:30 UTC

[kafka] 01/01: Fix streams quickstart check in Jenkinsfile

This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a commit to branch minor-streams-quickstart-fix
in repository https://gitbox.apache.org/repos/asf/kafka.git

commit fe4bc915e39c51de9697c6d420f18ba13ebb8d8a
Author: David Arthur <mu...@gmail.com>
AuthorDate: Mon Sep 14 10:31:35 2020 -0400

    Fix streams quickstart check in Jenkinsfile
---
 Jenkinsfile | 47 +++++++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index c7df4c5..826f781 100644
--- a/Jenkinsfile
+++ b/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,29 +58,27 @@ 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 '''
-      echo "Y" | mvn archetype:generate \
-          -DarchetypeCatalog=local \
-          -DarchetypeGroupId=org.apache.kafka \
-          -DarchetypeArtifactId=streams-quickstart-java \
-          -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('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} \
+            -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 '''
-        mvn compile \
-            || { echo 'Could not compile streams quickstart archetype project'; exit 1; }
-      '''
+      dir('streams.examples') {
+        sh '''
+          mvn compile \
+              || { echo 'Could not compile streams quickstart archetype project'; exit 1; }
+        '''
+      }
     }
   }
 }