我正在调查 Jenkins 结账步骤的工作方式。因此,我创建了一个 Jenkins 管道作业,该作业配置为从 Git 存储库检出其源代码,并且在构建日志中看到以下输出:
// first build
No credentials specified
Cloning the remote Git repository
Cloning repository https://github.com/yoav-klein/JenkinsCheckout.git
> git.exe init C:\Program Files (x86)\Jenkins\workspace\CheckoutHowWorks # timeout=10
Fetching upstream changes from https://github.com/yoav-klein/JenkinsCheckout.git
> git.exe --version # timeout=10
> git.exe fetch --tags --force --progress -- https://github.com/yoav-klein/JenkinsCheckout.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe config remote.origin.url https://github.com/yoav-klein/JenkinsCheckout.git # timeout=10
> git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe config remote.origin.url https://github.com/yoav-klein/JenkinsCheckout.git # timeout=10
Fetching upstream changes from https://github.com/yoav-klein/JenkinsCheckout.git
> git.exe fetch --tags --force --progress -- https://github.com/yoav-klein/JenkinsCheckout.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 577a611e2409f7c2d58496a547766dae7852a5d4 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f 577a611e2409f7c2d58496a547766dae7852a5d4 # timeout=10
Commit message: "Update Jenkinsfile"
> git.exe rev-list --no-walk 577a611e2409f7c2d58496a547766dae7852a5d4 # timeout=10
// second build
No credentials specified
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/yoav-klein/JenkinsCheckout.git # timeout=10
Fetching upstream changes from https://github.com/yoav-klein/JenkinsCheckout.git
> git.exe --version # timeout=10
> git.exe fetch --tags --force --progress -- https://github.com/yoav-klein/JenkinsCheckout.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 577a611e2409f7c2d58496a547766dae7852a5d4 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f 577a611e2409f7c2d58496a547766dae7852a5d4 # timeout=10
Commit message: "Update Jenkinsfile"
> git.exe rev-list --no-walk 54d51edfe239691b90bfd697859c8b58d715a72e # timeout=10
我的问题是:
git.exe rev-parse --is-inside-work-tree
- 我猜 Jenkins 需要检查它是否在 Git 存储库中以了解是否运行 git init
命令。但是在第一次运行时,它没有检查这个.. ?git rev-parse
和 refs/remotes/origin/master
运行 refs/remotes/origin/origin/master
?git fetch
?git.exe config remote.origin.url https://github.com/yoav-klein/JenkinsCheckout.git # timeout=10
命令,为什么?git rev-list --no-walk <commit-id>
?谢谢!