qq_21500619 2020-05-11 18:30 采纳率: 0%
浏览 1767

jenkins pipeline 流水线的step不执行,导致流水线退出。

描述:

    我运行pipeline,有几次会退出,退出信息如下:

    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

我的pipeline写法如下

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') {
            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"
            }
        }
    }
}

我的现象如下:

    "npm install" or "npm build" 是我的jenkinsfile配置
    当脚本运行到"npm config" ,下一步应该是"npm install",但是没有执行,之后流水线退出了。我运行相同的jenkinsfile,有时候成功、有时候失败,而且失败的位置也不同,有时候是"npm install"或者"npm build"等等.
  • 写回答

1条回答

  • dabocaiqq 2020-05-12 10:32
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?