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 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?