Daniel Retief Fourie
Daniel Retief Fourie

Reputation: 626

Cannot create CI Bot in XCode 6.0.1 with OSX Server 3.2.1

I have upgraded to OSX Server 3.2.1, and I have added my repository in XCode account preferences. Our git repository is hosted on a TFS server (as my company mostly works with Microsoft systems). I access TFS server via HTTPS.

Now, I can add the repository, it prompts for credentials which I supply, and the repository is added successfully. I configure the project by Source Code -> Project Name - Branch -> Configure Project after which I can checkout the code via Source Code menu successfully.

However when I create a bot via Product -> Create Bot, I select a schema and a server and give the bot a name. XCode then tries to verify the settings and fails with the following:

Credentail Failure

I have accessed the repository via a browser using the same credentials. It seems that for some reason, XCode just doesn't deal well with the credentials.

Any idea of how to fix this?

Upvotes: 1

Views: 766

Answers (2)

anorskdev
anorskdev

Reputation: 1925

Wish I had caught the nugget in the above answer that the Xcode bots cannot handle a repository name with spaces.

I had to give up for a while. When Xcode 6.1.1 came out, I tried again, but still struggled for days to get past authentification. Finally located problem when running Xcode manually with logging:

/Applications/Xcode.app/Contents/MacOS/Xcode -XCSUISourceControlLogLevel 2

In the logging, I noticed that someone tried to replace the space with '%2520'. In most other places where the URL to the repository is expanded, one sees '%20'.

I am using a local Xcode server and ssh. So, if your app name has a space in the name (more than a single word), try this:

1) DO NOT USE the "+ Create New Remote..." under Xcode/Source Control/[Your Project]/Configure [Your Project]... (This would create the repository with a space in the name.)

2) Using Server, create a repository without spaces in the name. Select Xcode in the left panel, use the "Repositories" tab, click "+", and type in a name without spaces. Then hit "Create".

3) Back on your development machine use "Add Remote" under Xcode/Source Control/[Your Project]/Configure [Your Project]... (+ under the Remotes Tab). Enter path to the repository like:

Name: origin Address: ssh://[email protected]/git/NoSpaceName.git

You may be asked for your password. When your development machine is able to reach the repository, you can check in code. Then you can go ahead and create the the bot. When creating the bot you may be asked to provide repository credentials. Select change and give username and password. Then select next to set up bot parameters such as Schedule, etc. til bot is created.

FYI. You may be bringing Xcode up and down several times if you need to remove links to old/bad repositories that you will find under Xcode/Preferences.../Accounts and under Xcode/Source Control/[Your Project]/Configure [Your Project]...

Upvotes: 1

Daniel Retief Fourie
Daniel Retief Fourie

Reputation: 626

I seem to have found the solution. The Unexpected HTTP status code: 404 (-1) isn't directly related to failing auth.

The authentication is successful, but now the location of the 'develop' branch cannot be found by the repository. The reason is that our repository is located inside an on-premises TFS implementation that contains spaces in the repository name.

For some reason, Xcode can do a checkout of the code with no problems whatsoever, but the Xcode bots cannot handle a repository name / URL that contains spaces.

Also, TFS does not allow you to change a repository name. So we solved this particular issue by using Charles to do URL Rewriting on the request. That seems to have solved the problem.

Thanks!

Upvotes: 3

Related Questions