I need to execute JavaScript script after ending of build. This script should use npm packages. Installed plugin as I have is: post-build actions
. I've found something like execute script with option: add generic file script
. If I give here path to. js
script, will it work? Where should I place this script?
I can not check it easily because I do not have full control of this Jenkins instance.
You can add you script to your npm package.json
scripts section and run it like:
post {
success {
script {
sh "npm run my-happy-script"
}
}
failure {
script {
sh "npm run my-sad-script"
}
}
}
Also you can select which directory to run from with the dir
command in your script block:
script {
dir("lib/another/directory") {
sh "node some-script.js"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.