jenkins test webhook Gitea test 24 jenkinsfile
This commit is contained in:
79
Jenkinsfile
vendored
79
Jenkinsfile
vendored
@@ -1,11 +1,28 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
NODE_ENV = 'production'
|
||||||
|
}
|
||||||
|
|
||||||
tools {
|
tools {
|
||||||
nodejs 'nodejs' // Ensure this matches the name defined in Jenkins
|
nodejs 'nodejs' // Ensure this matches the name defined in Jenkins
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
try {
|
||||||
|
// Code aus dem Repository holen
|
||||||
|
git branch: 'develop', url: 'http://172.19.0.2:3000/Ismail/NodeMap.git'
|
||||||
|
} catch (Exception e) {
|
||||||
|
error "Branch 'develop' exists nicht im Repository"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Check Node.js Version') {
|
stage('Check Node.js Version') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
@@ -13,5 +30,67 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Install Dependencies') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
try {
|
||||||
|
// Install dependencies
|
||||||
|
sh 'npm install'
|
||||||
|
} catch (Exception e) {
|
||||||
|
error "Dependency Installation failed: ${e.message}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
try {
|
||||||
|
// Build the project
|
||||||
|
sh 'npm run build'
|
||||||
|
} catch (Exception e) {
|
||||||
|
error "Build failed: ${e.message}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
try {
|
||||||
|
// Run tests
|
||||||
|
sh 'npm test'
|
||||||
|
} catch (Exception e) {
|
||||||
|
error "Tests failed: ${e.message}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
try {
|
||||||
|
// Add your deployment steps here
|
||||||
|
// For example: sh 'npm run deploy'
|
||||||
|
echo 'Deployment steps go here'
|
||||||
|
} catch (Exception e) {
|
||||||
|
error "Deployment failed: ${e.message}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'Build, tests, and deployment were successful!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Build, tests, or deployment failed.'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user