Jenkins update
This commit is contained in:
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
@@ -1,6 +1,6 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
BUILD_TIMESTAMP = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').format(new java.util.Date())
|
BUILD_TIMESTAMP = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').format(new java.util.Date())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,25 @@ pipeline {
|
|||||||
sh 'ls -la'
|
sh 'ls -la'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Check for package.json changes') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Check if package.json has changed
|
||||||
|
def hasChanges = sh(script: 'git diff --name-only HEAD~1 | grep "package.json"', returnStatus: true) == 0
|
||||||
|
if (hasChanges) {
|
||||||
|
echo "package.json changed, running npm install"
|
||||||
|
currentBuild.result = 'SUCCESS'
|
||||||
|
} else {
|
||||||
|
echo "package.json not changed, skipping npm install"
|
||||||
|
currentBuild.result = 'SUCCESS'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Install Dependencies') {
|
stage('Install Dependencies') {
|
||||||
|
when {
|
||||||
|
expression { currentBuild.result == 'SUCCESS' }
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'npm install'
|
sh 'npm install'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user