簡體   English   中英

Jenkins沒有此類文件或目錄錯誤。 但是文件存在

[英]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.

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