From fdf47c42269f7adb7d5f3e60b8180e8b9bc77503 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sat, 26 Jan 2019 10:04:13 +0100
Subject: Jenkins: cleanup

---
 Jenkinsfile | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'Jenkinsfile')

diff --git a/Jenkinsfile b/Jenkinsfile
index d1d8ad95..4bc64b26 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -30,14 +30,16 @@ pipeline {
         stage('Submodule Init') {
             steps {
                 sh '''
-                    git submodule update --init --recursive
-                    git submodule update --remote
+                    git submodule update --init --recursive --remote
                 '''
             }
         }
         stage('Build Packages') {
             steps {
-                sh 'scripts/build-submodules --verbose'
+                sh '''
+                    #!/bin/sh
+                    scripts/build-submodules --verbose
+                '''
             }
         }
 
@@ -68,7 +70,12 @@ pipeline {
             echo 'One way or another, I have finished'
             // the 'build' directory got elevated permissions during the build
             // cdjust permissions so it can be cleaned up by the regular user
-            sh 'sudo chmod -R 777 build/'
+            sh '''
+                #!/bin/bash
+                if [ -d build ]; then
+                    sudo chmod -R 777 build/
+                fi
+            '''
             deleteDir() /* cleanup our workspace */
         }
     }
-- 
cgit v1.2.3