diff --git a/Jenkinsfile b/Jenkinsfile index 0ebba4a99..86463318b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,61 @@ Jenkinsfile (Declarative Pipeline) /* Requires the Docker Pipeline plugin */ pipeline { - agent { docker { image 'node:20.15.1-alpine3.20' } } + agent any + + environment { + NODE_ENV = 'production' + } + stages { - stage('build') { + stage('Checkout') { steps { - sh 'node --version' + // Code aus dem Repository holen + git branch: 'main', url: 'http://localhost:3003/Ismail/NodeMap.git' + } + } + + stage('Install Dependencies') { + steps { + script { + // Node.js Version setzen + nodejs('nodejs') { + // Abhängigkeiten installieren + sh 'npm install' + } + } + } + } + + stage('Build') { + steps { + script { + nodejs('nodejs') { + // Projekt bauen + sh 'npm run build' + } + } + } + } + + stage('Test') { + steps { + script { + nodejs('nodejs') { + // Tests ausführen + sh 'npm test' + } + } } } } -} \ No newline at end of file + + post { + success { + echo 'Build and tests were successful!' + } + failure { + echo 'Build or tests failed.' + } + } +}