2015-10-07 71 views
0

我試圖通過與詹金斯的ssh連接執行腳本。我正在使用SSH plugin,並且配置良好。我到達執行腳本的第一部分,但是當我嘗試執行FPM命令它說:如果使用jenkins和ssh執行腳本,fpm無法識別

fpm: command not found 

如果我連接到該實例並運行,我通過詹金斯調用同一個腳本運行,有沒有錯誤(安裝了fpm)。

所以,我創建了像腳本test.sh測試:

#!/bin/bash -x 
fpm 

但是,與詹金斯,我得到了同樣的錯誤:fpm: command not found,而如果我執行我得到它需要一個正常的「參數「:

Missing required -s flag. What package source did you want? {:level=>:warn} 
Missing required -t flag. What package output did you want? {:level=>:warn} 
No parameters given. You need to pass additional command arguments so that I know what you want to build packages from. For example, for '-s dir' you would pass a list of files and directories. For '-s gem' you would pass a one or more gems to package from. As a full example, this will make an rpm of the 'json' rubygem: `fpm -s gem -t rpm json` {:level=>:warn} 
Fix the above problems, and you'll be rolling packages in no time! {:level=>:fatal} 

我在想什麼?爲什麼安裝時找不到fpm?

+1

當您對節點(或實例)進行測試時,是否使用了相同的linux用戶? (你使用SSH插件的那個)。也許這個用戶的PATH是不同的。 –

+0

是的,一樣的用戶 – sop

回答

0

看來問題出現了,因爲fpm安裝在/home/user2connect/bin/中,並且該命令未被識別。爲了解決這個,我不得不把它機智的整個路徑:

/home/user2connect/bin/fpm ... 

我選擇重新安裝使用sudofpm,所以現在它的工作原理。

+0

如果我上面的評論幫助,請投票;) –

+0

嗯ID沒有,但它是一個很好的評論;) – sop