从Jenkins执行放置在Git Hub存储库中的R脚本

时间:2019-01-15 14:33:55

标签: r git jenkins github

我想执行放置在Git中心存储库中的R脚本,因为我已经在Windows中执行了以下步骤。

  1. 用詹金斯创造了工作。

  2. 安装R插件。

  3. 提供项目URL https://github.com/kartikchhabra/project,并且在源代码管理存储库URL下。

  4. 在构建步骤下,我选择了Execute R脚本,之后我将该脚本留空,因为该脚本存在于我的git存储库中(可能是我在这里错了)。

  5. 然后我将其保存并单击立即构建选项,但它显示以下输出错误

  6. 我还尝试编写R脚本,该脚本在第4步中留空白,但再次显示错误

    Started by user kartik chhabra
    Building in workspace C:\Users\KC\.jenkins\workspace\R
     > git.exe rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git.exe config remote.origin.url https://github.com/kartikchhabra   
     /project >git # timeout=10
    Fetching upstream changes from https://github.com/kartikchhabra/project.git
     > git.exe --version # timeout=10
     > git.exe fetch --tags --progress https://github.com/kartikchhabra
     /project.git +refs/heads/*:refs/remotes/origin/*
     > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
     > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" #
    timeout=10
        Checking out Revision 5ea2bf887ed2b5a59bec568d0d5e1dfa6c7e4575
    (refs/remotes/origin/master)
     > git.exe config core.sparsecheckout # timeout=10
     > git.exe checkout -f 5ea2bf887ed2b5a59bec568d0d5e1dfa6c7e4575
    Commit message: "Delete README.md"
     > git.exe rev-list --no-walk 5ea2bf887ed2b5a59bec568d0d5e1dfa6c7e4575
    #timeout=10
    [R] $ Rscript C:\Users\KC\AppData\Local\Temp\jenkins6857605170924535377.R
    The system cannot find the file specified
    FATAL: command execution failed
    java.io.IOException: CreateProcess error=2, The system cannot find the file
    specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
    Caused: java.io.IOException: Cannot run program "Rscript" (in directory
    "C:\Users\KC\.jenkins\workspace\R"): CreateProcess error=2, The system cannot
    find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source)
        at hudson.Proc$LocalProc.<init>(Proc.java:249)
        at hudson.Proc$LocalProc.<init>(Proc.java:218)
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)``
        at hudson.Launcher$ProcStarter.start(Launcher.java:455)
        at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
       at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
       at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
       at
        hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
        at hudson.model.Build$BuildExecution.build(Build.java:206)
        at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at     hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1810)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
    Build step 'Execute R script' marked build as failure
   Finished: FAILURE

能帮我在工作的控制台输出中显示我的输出吗?

这是我尝试执行的脚本:

x <- c(2,5,3,5,9,8,6)
count <- 0
for (val in x) {
if(val %% 2 == 0)  count = count+1
}
print(count)

0 个答案:

没有答案