简体   繁体   English

OS X Server-机器人无法从存储库获取源

[英]OS X Server - bot can't get source from repository

I had a previous version of OS X Server set up and running fine, but when I installed the upgrade to 3.2.1, I found that none of my bots would work correctly. 我已经安装了OS X Server的先前版本,并且运行良好,但是当安装升级至3.2.1时,我发现我的所有机器人都无法正常工作。 These are the issues I get on each attempted integration: 这些是我每次尝试集成时都会遇到的问题:

Build Service Error Can't fit data in the buffer (-1). 生成服务错误无法将数据放入缓冲区(-1)。

Build Service Warning The source control operation failed because no working copy could be found. 生成服务警告源控制操作失败,因为找不到工作副本。

Build Service Warning An error occurred updating existing checkout. 生成服务警告更新现有结帐时发生错误。 Falling back to a clean checkout.. 退回干净的结帐。

I may be looking in the wrong place, but I think the errors mean that I can't connect to my Git repository. 我可能在错误的位置查看,但是我认为错误意味着我无法连接到我的Git存储库。 This was partially confirmed when I deleted my repository from Xcode and ran the bot again and got the same errors. 当我从Xcode删除存储库并再次运行bot并得到相同的错误时,部分确认了这一点。 (I have since re-added the repository in Xcode and performed a Check Out to test it, so am pretty certain I have all the connection details right.) (此后,我已经在Xcode中重新添加了存储库并执行了检出以对其进行测试,因此可以肯定的是我拥有所有连接详细信息。)

With the previous version of OS X Server, I'm sure I'd connected to the repository directly from the server, as explained in Help > Server Tutorials > Automate Xcode builds : 使用OS X Server的先前版本,我确定我已直接从服务器连接到存储库,如“ Help > Server Tutorials > Automate Xcode builds

Step 3. Give Xcode service access to the git repository 步骤3.授予Xcode服务对git存储库的访问权限

Xcode service bots access projects and code from your source git repository. Xcode服务机器人从您的源git存储库访问项目和代码。

Click Repositories, then click the Add button (+). 单击存储库,然后单击添加按钮(+)。 Choose Connect to a Git Repository from the New Repository pop-up menu. 从“新建存储库”弹出菜单中选择“连接到Git存储库”。

But in the latest version, when you click the Add button you just get the option to create a new repository, rather than connect to an existing one. 但是在最新版本中,当您单击“添加”按钮时,您仅获得创建新存储库的选项,而不是连接到现有存储库。 And the instructions on the web (now) say: 网络上(现在)的说明说:

Connect to Remote Repositories 连接到远程存储库

If you have projects in Git or Subversion repositories on remote servers, you can store your credentials for them on your development Mac in the Accounts preferences in Xcode. 如果您在远程服务器上的Git或Subversion存储库中有项目,则可以在Xcode的“帐户”首选项中在开发Mac上存储它们的凭据。 Then, when you need to access the repositories, you won't have to reenter your credentials every time. 然后,当您需要访问存储库时,不必每次都重新输入凭据。

To add a remote repository's credentials to a development Mac 要将远程存储库的凭据添加到开发Mac

For Xcode Server to perform integrations on your projects, it must also have access to their source code repositories. 为了使Xcode Server在您的项目上执行集成,它还必须有权访问其源代码存储库。 Configure Xcode Server to connect to your remote repositories. 配置Xcode Server以连接到远程存储库。

  • Choose Xcode > Preferences on your development Mac. 在开发Mac上选择“ Xcode”>“首选项”。

  • Click Accounts in the toolbar. 单击工具栏中的“帐户”。

  • Click the Add button (+), and choose Add Repository. 单击添加按钮(+),然后选择添加存储库。

  • In the text field, enter the URL for the repository (for example, svn+ssh://svn.example.com/ProjectName or https://example.com/git/repository.git ), and click the Next button. 在文本字段中,输入存储库的URL(例如svn + ssh://svn.example.com/ProjectName或https://example.com/git/repository.git ),然后单击“下一步”按钮。

  • Enter your user name and password in the Repository pane of Accounts preferences. 在“帐户”首选项的“存储库”窗格中输入您的用户名和密码。

which is a bit vague, but seems to suggest that now OS X Server uses repositories that are set up in Xcode's preferences. 这有点含糊,但似乎暗示现在OS X Server使用在Xcode的首选项中设置的存储库。

Anyway, now my OS X Server can't seem to access the repository. 无论如何,现在我的OS X Server似乎无法访问存储库。 Am I missing something here? 我在这里想念什么吗?

Thanks 谢谢

UPDATE: 更新:

I've come back to this problem after a month of pretending it didn't exist, and have made the following findings: 假装一个月不存在后,我又回到了这个问题,并得出以下发现:

-The problem occurs with OS X Server 3.2.1, OS X Server 3.2.2 and OS X Server 4.0, on two different machines. -在两台不同的计算机上,OS X Server 3.2.1,OS X Server 3.2.2和OS X Server 4.0会出现问题。

-The problem occurs when the repo is on a server running Gitblit, but not for remote Bitbucket repos, or for a Git repo hosted within a local OS X Server. -当回购位于运行Gitblit的服务器上,而不是远程Bitbucket回购或本地OS X Server中托管的Git回购时,会出现问题。

-The problem only occurs for larger repos. -该问题仅在较大的存储库中发生。

I've solved this problem in the most convoluted way imaginable! 我已经可以想象到的最复杂的方式解决了这个问题!

When OS X Server connects to the repository to download the source, it uses the Xcode library. 当OS X Server连接到资源库以下载源代码时,它将使用Xcode库。 Xcode uses libgit2 to do the downloading which had a known bug which caused the buffer error. Xcode使用libgit2进行下载,该下载有一个导致缓冲区错误的已知错误。 It was fixed in v0.21.2, but the latest Xcode (6.1.1) only uses v0.21. 它已在v0.21.2中修复,但最新的Xcode(6.1.1)仅使用v0.21。 That previous Xcode version only used v0.20, so hopefully a future Xcode release will use v0.21.2+ in which case this fix shouldn't be necessary. 先前的Xcode版本仅使用v0.20,因此希望将来的Xcode版本将使用v0.21.2 +,在这种情况下,此修补程序不是必需的。

Anyway, the solution for Xcode 6.1.1 was to: 无论如何,Xcode 6.1.1的解决方案是:

  1. Download and unzip the version of gitlib used by Xcode from here: https://github.com/libgit2/libgit2/releases/tag/v0.21.0 从此处下载并解压缩Xcode使用的gitlib版本: https : //github.com/libgit2/libgit2/releases/tag/v0.21.0
  2. Make the changes to src/transports/http.c as detailed here: https://github.com/libgit2/libgit2/commit/7d729d0bfd897e8685099b160b6dbfd7f4ebd588 如以下详细说明,对src / transports / http.c进行更改: https : //github.com/libgit2/libgit2/commit/7d729d0bfd897e8685099b160b6dbfd7f4ebd588
  3. Save the http.c file 保存http.c文件
  4. Build your edited version of gitlib2 using the instructions here , ie: 使用此处的说明来构建gitlib2的编辑版本,即:

    • Download CMake 下载CMake
    • Run the following commands in Terminal after navigating to your unzipped libgit2-0.21.0 folder: 导航到解压缩的libgit2-0.21.0文件夹后,在终端中运行以下命令:

      $ mkdir build && cd build $ mkdir构建&& cd构建

      $ cmake .. $ cmake ..

      $ cmake --build . $ cmake --build。

  5. In Finder on your server , go to the Applications folder, right-click on Xcode and select "Show Package Contents". 服务器上的 Finder中,转到Applications文件夹,右键单击Xco​​de并选择“显示包内容”。 Go to the Contents/Developer/usr/lib folder and rename the 'libgit2.dylib' file to 'libgit2.dylibold' or similar. 转到Contents / Developer / usr / lib文件夹,并将“ libgit2.dylib”文件重命名为“ libgit2.dylibold”或类似文件。

  6. Take the newly created 'libgit2.0.21.0.dylib' file from the libgit2-0.21.0/build folder, rename it to 'libgit2.dylib' and copy it into the /Applications/Xcode/Contents/Developer/usr/lib folder on your server. 从libgit2-0.21.0 / build文件夹中获取新创建的'libgit2.0.21.0.dylib'文件,将其重命名为'libgit2.dylib'并将其复制到/ Applications / Xcode / Contents / Developer / usr / lib服务器上的文件夹。

  7. Restart OS X Server, and integrate your bot again from Xcode. 重新启动OS X Server,然后再次从Xcode集成您的bot。

The remote repository will be added when you create a bot. 创建机器人时,将添加远程存储库。 You don't have to add repository in OSX server. 您不必在OSX服务器中添加存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM