2016-10-28 44 views
1

我想從詹金斯運行批處理文件,但無法運行。 在預生成步驟中,我輸入了我想要執行的文件,但是我得到如下所示的堆棧跟蹤。詹金斯不承認cmd命令。如何從詹金斯運行批處理文件

我該如何解決這個問題?

Started by user Jenkins 
[EnvInject] - Loading node environment variables. 
Building in workspace /srv/jenkins/workspace/gaa-integratietest-daily 
> git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> git config remote.origin.url ssh://[email protected]:7999/gaa/gaa_test_milieu.git # timeout=10 
Fetching upstream changes from ssh://[email protected]:7999/gaa/gaa_test_milieu.git 
> git --version # timeout=10 
> git -c core.askpass=true fetch --tags --progress ssh://[email protected]:7999/gaa/gaa_test_milieu.git +refs/heads/*:refs/remotes/origin/* 
> git rev-parse origin/develop^{commit} # timeout=10 
Checking out Revision 337d5b94e05f2c915e05de2c2535d5af180d4326 (origin/develop) 
> git config core.sparsecheckout # timeout=10 
> git checkout -f 337d5b94e05f2c915e05de2c2535d5af180d4326 
> git rev-list 337d5b94e05f2c915e05de2c2535d5af180d4326 # timeout=10 
[gaa-integratietest-daily] $ /bin/sh -xe /tmp/hudson1965771098535657790.sh 
+ cmd /c qclient.bat 
/tmp/hudson1965771098535657790.sh: line 2: cmd: command not found 
Build step 'Execute shell' marked build as failure 
[gaa-integratietest-daily] $ /usr/share/maven/bin/mvn -f pom.xml -gs /srv/maven/settings.xml clean deploy -fae 
[INFO] Scanning for projects... 
[ERROR] The build could not read 1 project -> [Help 1] 
[ERROR] 
[ERROR] The project (/srv/jenkins/workspace/gaa-integratietest-daily/pom.xml) has 1 error 
[ERROR]  Non-readable POM /srv/jenkins/workspace/gaa-integratietest-daily/pom.xml: /srv/jenkins/workspace/gaa-integratietest-daily/pom.xml (No such file or directory) 
[ERROR] 

回答

0

您的Linux Jenkins從站不支持cmd。爲了解決它,你有幾個選擇(從好到壞):

  1. 添加一個Windows從屬到Jenkins並從那裏運行cmd。
  2. 將您的批處理文件移植到bash或類似文件中,並從您的Linux Jenkins從服務器運行它。
  3. 在您的Linux Jenkins從設備中添加某種DOS模擬器(Wine,DOSBox,DOSemu)。

我的建議:如果你知道Linux的&擊,或者你有沒有詹金斯的控制去選擇2。否則,請選擇1.避免選項3.

0

您試圖在LINUX機器上運行CMD。或者將您運行的從屬設備更改爲Windows計算機,或將批處理腳本遷移到shell腳本。

祝你好運!