我们有一个Xcode CI bot设置来轮询我们的git存储库以获取新的提交并进行相应的构建。一般来说运行正常。然而,在强制推送(我知道)之后,机器人将失败并且永远不会再次正确构建。解决方案是删除机器人并重新开始(并告诫我们自己进行强制推动)。
在Xcode构建日志中没有错误,点击控制台我们只能确认问题所在(参见最后一个日志)......
Jan 28 08:15:51 macmini.local xcsbuildd[80853]: [CSBotSCMAction gitCloneRepositoryAtURL:branch:destinationPath:createDirectoryNamed:completionBlock:] : https://github.com/XXXXXXXX/iOS.git
Jan 28 08:15:51 macmini.local xcsbuildd[80853]: newRepoURL: https://github.com/XXXXXXXX/iOS.git
"https:\/\/githubuserformacmini@github.com\/XXXXXXXX\/iOS.git",
"https_github_com_XXXXXXXX_iOS_git"
"launchCommand" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git clone https:\/\/githubuserformacmini@github.com\/XXXXXXXX\/iOS.git --recursive --verbose --progress https_github_com_XXXXXXXX_iOS_git",
"launchPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git",
"GIT_ASKPASS" : "\/Applications\/Server.app\/Contents\/ServerRoot\/usr\/libexec\/xcs_ssh_auth_agent",
Jan 28 08:18:29 macmini.local xcsbuildd[80853]: Obtaining the HEAD hash at: /Library/Server/Xcode/Data/BotRuns/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle/tmp/https_github_com_XXXXXXXX_iOS_git
Jan 28 08:18:29 macmini.local xcsbuildd[80853]: [CSBotSCMAction gitHeadHashesRepositoryAtPath:branch:completionBlock:] : /Library/Server/Xcode/Data/BotRuns/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle/tmp/https_github_com_XXXXXXXX_iOS_git
Jan 28 08:18:29 macmini.local xcsbuildd[80853]: newRepoURL: file:///Library/Server/Xcode/Data/BotRuns/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle/tmp/https_github_com_XXXXXXXX_iOS_git/
"launchCommand" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git show-ref --heads",
"launchPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git",
"currentDirectoryPath" : "\/Library\/Server\/Xcode\/Data\/BotRuns\/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle\/tmp\/https_github_com_XXXXXXXX_iOS_git",
"launchCommand" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git checkout release",
"launchPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git",
"GIT_ASKPASS" : "\/Applications\/Server.app\/Contents\/ServerRoot\/usr\/libexec\/xcs_ssh_auth_agent",
"currentDirectoryPath" : "\/Library\/Server\/Xcode\/Data\/BotRuns\/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle\/tmp\/https_github_com_XXXXXXXX_iOS_git",
Jan 28 08:18:29 macmini.local xcsbuildd[80853]: [CSBotSCMAction gitHeadHashesRepositoryAtPath:branch:completionBlock:] : https://github.com/XXXXXXXX/iOS.git
Jan 28 08:18:29 macmini.local xcsbuildd[80853]: newRepoURL: https://github.com/XXXXXXXX/iOS.git
"https:\/\/githubuserformacmini@github.com\/XXXXXXXX\/iOS.git"
"launchCommand" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git ls-remote --heads https:\/\/githubuserformacmini@github.com\/XXXXXXXX\/iOS.git",
"launchPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git",
"GIT_ASKPASS" : "\/Applications\/Server.app\/Contents\/ServerRoot\/usr\/libexec\/xcs_ssh_auth_agent",
Jan 28 08:18:30 macmini.local xcsbuildd[80853]: [CSBotSCMAction gitCommitSummaryForRepositoryURL:betweenHashIdentifier:andHashIdentifier:completionBlock:] : /Library/Server/Xcode/Data/BotRuns/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle/tmp/https_github_com_XXXXXXXX_iOS_git
"launchCommand" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git log --no-color --name-status --format=fuller --date=iso e478616e4b3915846f7938fec24e8dc12cdae52a..f2c1b24a6b801ed9f7e60dce60add1851618da64",
"launchPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/usr\/bin\/git",
"GIT_ASKPASS" : "\/Applications\/Server.app\/Contents\/ServerRoot\/usr\/libexec\/xcs_ssh_auth_agent",
"currentDirectoryPath" : "\/Library\/Server\/Xcode\/Data\/BotRuns\/BotRun-187dbc1a-dae2-4ddc-a75b-75831de7ff09.bundle\/tmp\/https_github_com_XXXXXXXX_iOS_git",
Jan 28 08:18:30 macmini.local xcsbuildd[80853]: [XCSCheckoutOperation.m:1033 7d02a310 +168ms] Error getting Git commit log in range e478616e4b3915846f7938fec24e8dc12cdae52a:f2c1b24a6b801ed9f7e60dce60add1851618da64 <stderr>= fatal: Invalid revision range e478616e4b3915846f7938fec24e8dc12cdae52a..f2c1b24a6b801ed9f7e60dce60add1851618da64
Jan 28 08:18:30 macmini.local xcsbuildd[80853]: [XCSCheckoutOperation.m:610 7d02a310 +0ms] Failed to get Git commit history for repo with error Error Domain=CSBotSCMAction Code=-1000 "fatal: Invalid revision range e478616e4b3915846f7938fec24e8dc12cdae52a..f2c1b24a6b801ed9f7e60dce60add1851618da64
我可以看到......
git log --no-color --name-status --format=fuller --date=iso e478616e4b3915846f7938fec24e8dc12cdae52a..f2c1b24a6b801ed9f7e60dce60add1851618da64
......来自整合。当我强行进入f2c1b24a6b801ed9f7e60dce60add1851618da64时,e478616e4b3915846f7938fec24e8dc12cdae52a是被删除的提交(我假设)。我不知道机器人在哪里保留这些信息。我尝试删除/ Library / Server / Xcode / Data / BotRuns中的所有内容,但是没有用。我想也许它是从/ Library / Server / Xcode / Data / BotRuns / Latest,nope拉出最后一个哈希。我还在/ Library / Server / Xcode中挖掘了大量其他目录而没有看到任何内容。
如果Xcode的CI方法让我们对git工作流程有任何控制,那就太好了。有一些非常少的配置选项。也许删除是唯一的方法。
答案 0 :(得分:1)
似乎有人删除了已经推送到远程的提交。大多数CI服务器使用此基本工作流检测存储库中的更改:
如果在远程存储库中删除了当前签出分支的HEAD,Git可能会失败。
您可以转到CI构建已签出Git存储库的目录并执行:
git reset --hard origin/branch_name
这将使您的本地和远程分支重新进入奇偶校验。然后你可能需要开始手动构建。
真正的答案是,当这些提交已被推送到遥控器时,不会改变Git的提交历史记录。