Files
nodeMap/Jenkinsfile

78 lines
2.0 KiB
Groovy

pipeline {
agent any
environment {
NODE_ENV = 'production'
}
stages {
stage('Checkout') {
steps {
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 {
try {
// Node.js Version setzen
nodejs('nodejs') {
// Abhängigkeiten installieren
sh 'npm install'
}
} catch (Exception e) {
error "Dependency Installation failed: ${e.message}"
}
}
}
}
stage('Build') {
steps {
script {
try {
nodejs('nodejs') {
// Projekt bauen
sh 'npm run build'
}
} catch (Exception e) {
error "Build failed: ${e.message}"
}
}
}
}
stage('Test') {
steps {
script {
try {
nodejs('nodejs') {
// Tests ausführen
sh 'npm test'
}
} catch (Exception e) {
error "Tests failed: ${e.message}"
}
}
}
}
}
post {
success {
echo 'Build and tests were successful!'
}
failure {
echo 'Build or tests failed.'
}
}
}