-
Bug
-
Resolution: Unresolved
-
Blocker
-
None
-
JENKINS_VERSION 2.156
pipeline-stage-step 2.3
kubernetes 1.14.2
Error Reulst:
npm config set registry https://registry.npm.taobao.org
npm config set 'sass-binary-site=http://npm.taobao.org/mirrors/node-sass'
process apparently never started in
/home/jenkins/workspace/demo_nodejs@tmp/durable-a15f6a06
ERROR: script returned exit code -2
Finished: FAILURE
jenkinsfile:
def registry = SECRET
def library = 'demo'
def name = 'nodejs_demo'
podTemplate(){
node('nodejs') { // my podtemplate is defined in global config, and can run well.
echo 'ready go'
def path = pwd()
def branch_ = ''
def author = ''
def version = ''
def image
branch_ = 'master'
echo 'branch_ = ' + branch_
// clone git
stage("clone code") {
git credentialsId: SECRET, branch: branch_, url: SECRET
sh 'git log --no-merges --pretty=format:"%an" -1 > author.txt'
sh 'git log --no-merges --pretty=format:"%h" --abbrev=8 -1 > version.txt'
sh 'url=`cat .git/config|grep git`&&url=${url##/}&&echo ${url%.} > name.txt'
author = readFile("author.txt")
version = readFile("version.txt")
image = "${registry}/${library}/${name}"
echo "${image}"
echo 'clone code complete'
}
- enter container.
container('nodejs')Unknown macro: { stage("nodejs install") { // my Step sh 'npm config set registry https://registry.npm.taobao.org' sh 'npm config set sass-binary-site=http://npm.taobao.org/mirrors/node-sass' sh 'npm install' // not execute it. } stage("nodejs build") { sh 'npm run build' } stage('copy dockerfile') { input "Exit" } }}
}
Status:
"npm install" or "npm build" is defined in my jenkinsfile.
when script run "npm config" In my jenkinsfile, the next step is "npm install", but it was not run, and my workflow is exit.
I use same jenkinsfile, I can receive success message if I am full luck.
The Error will be occur in other location, example after "npm install" or after "npm build" and soon.