diff --git a/Jenkinsfile b/Jenkinsfile index 58b948355..a9b8e305f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,18 +10,28 @@ pipeline { stages { stage('Checkout') { steps { - // Code aus dem Repository holen - git branch: 'main2', url: 'http://localhost:3003/Ismail/NodeMap.git' + script { + try { + // Code aus dem Repository holen + git branch: 'main2', url: 'http://localhost:3003/Ismail/NodeMap.git' + } catch (Exception e) { + error "Branch 'main2' exists nicht im Repository" + } + } } } stage('Install Dependencies') { steps { script { - // Node.js Version setzen - nodejs('nodejs') { - // Abhängigkeiten installieren - sh 'npm install' + try { + // Node.js Version setzen + nodejs('nodejs') { + // Abhängigkeiten installieren + sh 'npm install' + } + } catch (Exception e) { + error "Dependency Installation failed: ${e.message}" } } } @@ -30,9 +40,13 @@ pipeline { stage('Build') { steps { script { - nodejs('nodejs') { - // Projekt bauen - sh 'npm run build' + try { + nodejs('nodejs') { + // Projekt bauen + sh 'npm run build' + } + } catch (Exception e) { + error "Build failed: ${e.message}" } } } @@ -41,9 +55,13 @@ pipeline { stage('Test') { steps { script { - nodejs('nodejs') { - // Tests ausführen - sh 'npm test' + try { + nodejs('nodejs') { + // Tests ausführen + sh 'npm test' + } + } catch (Exception e) { + error "Tests failed: ${e.message}" } } } @@ -59,3 +77,4 @@ pipeline { } } } +