詹金斯中的 Git 结账

时间:2021-02-24 10:04:15

标签: git jenkins

我正在调查 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

我的问题是:

  1. 在第二个构建中,我看到第一步是 git.exe rev-parse --is-inside-work-tree - 我猜 Jenkins 需要检查它是否在 Git 存储库中以了解是否运行 git init 命令。但是在第一次运行时,它没有检查这个.. ?
  2. 为什么 Jenkins 使用 git rev-parserefs/remotes/origin/master 运行 refs/remotes/origin/origin/master
  3. 在第一次运行中,为什么 Jenkins 运行了两次 git fetch
  4. 在第一次运行中,Jenkins 运行了两次这个 git.exe config remote.origin.url https://github.com/yoav-klein/JenkinsCheckout.git # timeout=10 命令,为什么?
  5. 为什么 Jenkins 运行最后一个命令:git rev-list --no-walk <commit-id>

谢谢!

0 个答案:

没有答案
相关问题