詹金斯的示例管道显然无法正常工作

我安装了装有Jenkins 2.190.1的Ubuntu 18.04,并尝试运行简单的管道脚本

pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}

运行此操作会拉出图像,然后看起来像被卡住了,什么也没发生,但工作仍在进行。

我取消工作时,日志显示

$ docker run -t -d -u 122:127 -w /var/lib/jenkins/workspace/test-pipe -v /var/lib/jenkins/workspace/test-pipe:/var/lib/jenkins/workspace/test-pipe:rw,z -v /var/lib/jenkins/workspace/test-pipe@tmp:/var/lib/jenkins/workspace/test-pipe@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** node:7-alpine cat
$ docker top 154c572b654031349f2b338c22b932ced79339e48ad79a06e7665db1dfb9ae02 -eo pid,comm
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] sh // here it seems nothing is happening and no progress is happening
Aborted by admin
Sending interrupt signal to process
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 154c572b654031349f2b338c22b932ced79339e48ad79a06e7665db1dfb9ae02
$ docker rm -f 154c572b654031349f2b338c22b932ced79339e48ad79a06e7665db1dfb9ae02
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: failed to run ps
    at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Decorator$1.kill(WithContainerStep.java:342)
    at org.jenkinsci.plugins.durabletask.FilemonitoringTask$FilemonitoringController.stop(FilemonitoringTask.java:345)
    at org.jenkinsci.plugins.workflow.steps.durable_task.DurabletaskStep$Execution.stop(DurabletaskStep.java:512)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.stop(CpsThread.java:308)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$6.onSuccess(CpsFlowExecution.java:1151)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$6.onSuccess(CpsFlowExecution.java:1140)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:907)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:37)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.Futuretask.run(Futuretask.java:264)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.Futuretask.run(Futuretask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Finished: ABORTED

我的设置有什么问题?还是要研究的问题是什么?

谢谢

whj901180 回答:詹金斯的示例管道显然无法正常工作

显然Alpine Node容器没有引导到外壳中。您需要在脚本中指定外壳程序:

sh '''#!/bin/sh
    node --version
'''
本文链接:https://www.f2er.com/3146084.html

大家都在问