Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host key verification failed #661

Open
blindmonkey opened this issue Oct 13, 2023 · 3 comments
Open

Host key verification failed #661

blindmonkey opened this issue Oct 13, 2023 · 3 comments
Labels
question Further information is requested

Comments

@blindmonkey
Copy link

blindmonkey commented Oct 13, 2023

We've been using Periphery in our project for a while now, both in Xcode and on CI. Although we've encountered some issues previously (including this one), we've thus far been able to resolve them. But this time I'm stumped.

The error that we get when running Periphery is hard to identify, but it seems logical that it would be the same error that we'd get when just running the command in isolation.

error: Shell command '/usr/bin/env xcodebuild -project [REDACTED].xcodeproj -showBuildSettings -json -target [REDACTED] -target [REDACTED]Tests -target [REDACTED]HostedTests -target [REDACTED]Demo' returned exit status '74':

Running the command on its own also fails and this time actually prints the underlying error:

$ xcodebuild -workspace [REDACTED].xcworkspace -list -json
xcodebuild: error: Could not resolve package dependencies:
  Failed to clone repository git@github.com:[REDACTED]/[REDACTED].git:
    Cloning into bare repository '[REDACTED]'...
    Host key verification failed.
fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

As I mentioned, we've previously gotten this error, though it was for the /usr/bin/env xcodebuild -workspace [REDACTED] -list -json command. We managed to work around it by running the command directly before running Periphery, but this recently stopped working.

The repository in question is an SPM dependency hosted in a private repo, for which we use an SSH key added to ssh-agent. Our build commands specify both a -derivedDataPath (to ensure repeatable clean builds) and -clonedSourcePackagesDirPath (to cache our SPM dependencies). To ensure that things run properly on CI we also specify -scmProvider system -usePackageSupportBuiltinSCM arguments, and just to be completely sure we also run defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES.

None of these options seem to be specifiable to Periphery, and the options in com.apple.dt.Xcode (both in ~/Library/Preferences and /Library/Preferences) don't appear to be getting picked up.

This issue happens consistently both on the latest release (2.16.0) and on the version we were previously using (2.10.2).

@blindmonkey
Copy link
Author

blindmonkey commented Oct 16, 2023

I was able to work around the initial issue I reported by adding the key via /usr/bin/env ssh-add. It's not ideal to have to do this on CI, but it was a step forward. However, now Periphery is refusing to read the DataStore. It's not really clear why this would be, since not much has changed about our pipeline with the exception of provisioning a new machine for CI and that machine being on macOS Sonoma. We're using Xcode 14.3 with the intention of updating to 15.0 shortly.

When running in verbose mode, I'm seeing a number of errors like [index:swift] Source file not indexed: /Users/[REDACTED].swift, as well as a general error:

error: The index store at '["/Users/[REDACTED]/derivedData/Index.noindex/DataStore"]' does not contain data for the following targets: [REDACTED TARGETS]. Either the index store is outdated, or you have requested to scan targets that have not been built. For Xcode projects, the chosen schemes must build all of the chosen targets.

I spot checked the index store and it seems to have data (though I don't know how to read it). I was thinking that maybe it's a permissions issue, but I would've expected to see a more specific error around that if that were the case.

I saw on another issue to look out for WARNING: Using the first of multiple matching destinations and I am indeed seeing that in my build, but what's strange is that I'm seeing two simulators with exactly the same id.

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:CABE9B5B-FA28-4B26-8611-8ED67214C4D3, OS:16.4, name:iPhone 8 }
{ platform:iOS Simulator, id:CABE9B5B-FA28-4B26-8611-8ED67214C4D3, OS:16.4, name:iPhone 8 }

However, looking at our older builds, this issue seems to have existed for a while, and the version of Periphery that we were using seemed to handle this okay.

Any help or advice would be much appreciated.

Thank you in advance!

Edit: Looks like the original issue wasn't fully resolved after all. I'm still getting errors about fetching our private SPM dependencies, it just doesn't always happen.

@ileitch
Copy link
Contributor

ileitch commented Oct 29, 2023

Edit: Looks like the original issue wasn't fully resolved after all. I'm still getting errors about fetching our private SPM dependencies, it just doesn't always happen.

Are these errors happening when running xodebuild directly? If so, I think that needs to be resolved first before trying to diagnose the Periphery failures.

@ileitch ileitch added the question Further information is requested label Oct 29, 2023
@blindmonkey
Copy link
Author

Edit: Looks like the original issue wasn't fully resolved after all. I'm still getting errors about fetching our private SPM dependencies, it just doesn't always happen.

Are these errors happening when running xodebuild directly? If so, I think that needs to be resolved first before trying to diagnose the Periphery failures.

No, I'm not getting these errors directly. I was for a bit, but that was due to a misconfiguration with our build machines. Once I fixed that, I'm now able to run the xcodebuild commands directly but Periphery fails. My current workaround is to run $ xcodebuild -workspace [REDACTED].xcworkspace -list -json before running Periphery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants