任务描述:Jenkins Pipeline WebHook触发构建失败
1. 手动立即构建成功
2. Jenkins Gitee链接测试成功
3. Gitee WebHook测试成功
4. 失败的控制台输出
5. 解决方案
6. 任务来源
手动立即构建成功的控制台输出:
```
Started by Gitee push by Gitee
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on node2 in /home/jenkins/workspace/java
[Pipeline] {
[Pipeline] stage
[Pipeline] { (git)
[Pipeline] git
The recommended git tool is: NONE
No credentials specified
Cloning the remote Git repository
Cloning repository https://gitee.com/redhat/java-war-hello.git
stderr: fatal: ambiguous argument 'remotes/origin/test_version^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
Finished: FAILURE
```
解决方案:在执行git命令时,将路径和修订分开,如下所示:
```
git fetch origin +refs/heads/*:refs/remotes/*
git checkout test_version^{commit} -- test_version^{commit}
```