[英]Jenkins showing fopen: No such file or directory, but file exists
[英]Jenkins No such file or directory error. But the file exists
我在Jenkins中將bash腳本作為作業運行時遇到問題(執行shell步驟)。 基本上,我現在將腳本縮小為一行,以測試Jenkins為什么無法運行該腳本。 這里是:
waxsim
所以這只是一行。 當不帶參數運行時,應該給我這個輸出:
No app-path was specified!
usage: waxsim [options] app-path
example: waxsim -s 2.2 /path/to/app.app
Available options are:
-s sdk Version number of sdk to use (-s 3.1)
-f family Device to use (-f ipad)
-e VAR=value Environment variable to set (-e CFFIXED_HOME=/tmp/iphonehome)
-a Available SDKs
-v path Output video recording at path
-h Prints out this wonderful documentation!
Jenkins以jenkins用戶身份運行。 運行該作業后,它將失敗並顯示:
+ waxsim
/var/folders/gx/t63prwt53w7gr2jjt9k66q9800009c/T/hudson4478539334800834890.sh:
line 3: waxsim: No such file or directory
Build step 'Execute shell' marked build as failure
當我以jenkins用戶身份登錄手動執行waxsim
,一切正常。 它適用於計算機上的每個用戶。 它僅在詹金斯工作中執行時不起作用。 有人知道這可能是什么問題嗎?
我嘗試指定waxsim
的完整路徑,即: /usr/bin/waxsim
但這沒有區別。
謝謝!
事實證明,它在終端機中運行時有效,而在詹金斯(Jenkins)運行時卻無效的原因卻是微不足道的。
在終端中,我運行bash,Jenkins使用的是shell。 因此,將導出路徑添加到Jenkins的execute Shell腳本中解決了該問題。
只需在shell執行的頂部添加#!/bin/bash
即可獲得所需的結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.