根据官方教程,在Blue Ocean中重新运行管道失败

时间:2018-07-31 06:58:36

标签: jenkins jenkins-pipeline

我参考了Create a Pipeline in Blue Ocean教程,并在蔚蓝的大海中创建了一条管道。在Create your initial Pipeline步骤,我指定了node:6-alpine和 -p 3000:3000 -u 0:0 ,因为遇到错误。需要管理员用户才能安装npm。然后它运作良好。但是,在Add a test stage to your Pipeline,我遇到了另一个错误,控制台输出如下:

Obtained Jenkinsfile from 27a4b966c64413b478463afe3c6a868981009fbb
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/peline-in-blue-ocean_master-QHFKIFNIE7FNOZAOJPKBO6ZC46A7K77SYSFL3CJH2A3XUPNOLXUQ
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/niaomingjian/creating-a-pipeline-in-blue-ocean.git # timeout=10
Cleaning workspace
 > git rev-parse --verify HEAD # timeout=10
Resetting working tree
 > git reset --hard # timeout=10
 > git clean -fdx # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/niaomingjian/creating-a-pipeline-in-blue-ocean.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate(ACL.java:290)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.plugins.git.GitException: Command "git clean -fdx" returned status code 1:
stdout: 
stderr: warning: failed to remove node_modules/abab/package.json: Permission denied
warning: failed to remove node_modules/abab/README.md: Permission denied
warning: failed to remove node_modules/abab/index.js: Permission denied

然后我尝试在Blue Ocean中创建另一个管道,其行为类似。看来这与 git clean 的许可有关。构建工作at the first time,但失败at the second time。但是在最初,git clean可以工作。

enter image description here

由于node_modules属于根目录,因此 git clean 不适用于该目录。如何配置以让jenkins用户在Create a Pipeline in Blue Ocean步骤安装npm。

0 个答案:

没有答案