Mit jenkinsfile
This commit is contained in:
59
Jenkinsfile
vendored
59
Jenkinsfile
vendored
@@ -1,12 +1,61 @@
|
|||||||
Jenkinsfile (Declarative Pipeline)
|
Jenkinsfile (Declarative Pipeline)
|
||||||
/* Requires the Docker Pipeline plugin */
|
/* Requires the Docker Pipeline plugin */
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { docker { image 'node:20.15.1-alpine3.20' } }
|
agent any
|
||||||
stages {
|
|
||||||
stage('build') {
|
environment {
|
||||||
steps {
|
NODE_ENV = 'production'
|
||||||
sh 'node --version'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
// 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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'Build and tests were successful!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Build or tests failed.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user