git - 詹金斯无法在 git repo 中找到目录
问题描述
我已经在我的 ubuntu 机器上的 ssh 服务器上安装了 jenkins。我创建了一个构建 C++ 项目的工作。
该作业执行 shell 命令:
cd exact-arithmetic/
qmake exact-arithmetic.pro
make
当作业建立时,我收到以下错误
Building in workspace /var/lib/jenkins/workspace/integerBuild
Cloning the remote Git repository
Cloning repository REPONAME
> git init /var/lib/jenkins/workspace/integerBuild # timeout=10
Fetching upstream changes from REPONAME
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress REPONAME +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url REPONAME # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url REPONAME # timeout=10
Fetching upstream changes from REPONAME
using GIT_ASKPASS to set credentials
> git fetch --tags --progress REPONAME +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision d1d90929149a6de918bae21bdc6710c1965a81a5 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f d1d90929149a6de918bae21bdc6710c1965a81a5
Commit message: "Peronalisation files for git"
> git rev-list --no-walk d1d90929149a6de918bae21bdc6710c1965a81a5 # timeout=10
[integerBuild] $ /bin/sh -xe /tmp/jenkins5258842808869431608.sh
+ cd exact-arithmetic/
/tmp/jenkins5258842808869431608.sh: 2: cd: can't cd to exact-arithmetic/
Build step 'Execute shell' marked build as failure
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
Finished: FAILURE
詹金斯连接到回购没有问题。当我查看 github 存储库时,我看到目录精确算术存在。
但是,我已经运行了一个执行命令行 ls 的作业,并且我的目录都没有出现。我不确定我做错了什么,并且似乎找到了很多有用的信息。
任何帮助表示赞赏。
解决方案
从您的评论中:
ls
返回一个空文件夹pwd
返回您当前的工作区:/var/lib/jenkins/workspace/integerBuild
您的文件夹exact-arithmetic/
不存在。
要创建它,您可以在流程中添加命令:
mkdir -p exact-arithmetic/
仅当文件夹尚不存在时才会创建该文件夹。它将解决您的错误,但您将无法构建。
我的猜测是您的来源尚未在您的 git 工作流程中克隆。
我建议你git init
用
git clone https://github.com/USERNAME/REPOSITORY.git
Git init
创建一个新的仓库。但git clone
会得到你现有回购的来源。git fetch
将获得您想要测试的更改。
推荐阅读
- postgresql - Postgres Jsonb 聚合
- android - 发现蓝牙设备并附加到 TableLayout
- java - 如何使用 ModelMapper 调用测试服务方法
- java - 有没有更快的方法来运行一个类而不将其更改为主类?
- wordpress - 带 Walker 的 WordPress 自定义菜单 3 级
- arrays - 从matlab中的数组中按索引删除行
- android - NFC 标签上带有特殊字符的 URL 适用于 Android,但不适用于 iOS (iPhone)
- laravel - 命令“schedule:list”未定义。拉拉维尔 6
- php - 在 PHP 和 MySQL(getter 和 setter)中由具有属性而不是直接列值的对象处理
- android - Android WebView 失败(net::ERR)