簡體   English   中英

使用管道作為代碼在 jenkins master 上找不到返回的 shell 腳本

[英]shell script returning not found on jenkins master using pipeline as code

我是 jenkins 的新手,正在嘗試編寫管道。 運行作業時一切正常,但面臨管道問題。 我應該在從 github 簽出后運行的腳本返回找不到文件。 任何人都可以請幫忙。 附上日志圖片。 https://i.stack.imgur.com/LuxGn.png下面是我試圖執行的代碼示例。

 stage('puppet master config checkout') {
        steps {
            echo "cloning github"
            git "https://github.com/rk280392/pipeline_scripts.git"
        }

    }
     stage('puppet master config build') { 
        steps {
            echo "running puppet master script"
            sh "puppet_master.sh"
        }

    }
  1. 在 git 步驟之后使用命令 sh 'ls' 檢查文件腳本在這里。 通常我會建議不要使用 git step 而是使用 checkout ,它更強大,更可靠
    checkout([
         $class: 'GitSCM',
         branches: scm.branches,
         extensions: scm.extensions,
         userRemoteConfigs: [[
             url: 'https://github.com/rk280392/pipeline_scripts.git'
         ]]
    ])
  1. 你的腳本是可執行的嗎? 您可以使用chmod +x puppet_master.sh在以點斜杠作為前綴運行它之前使用./puppet_master.sh
sh 'sh puppet_master.sh'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM