iOS Azure Pipeline

Apr 23, 2020 15:47 · 231 words · 2 minute read

Update (May 7, 2020)

It seems that what I described below is not necessary if you use https for getting your dependencies.

I got the task of setting up a build pipeline for an iOS project using Azure DevOps. By following the documentation, this was easy to set up a dummy project without any dependencies. If you are using CocoaPod or Carthage for dependency management, you’ll find tasks that support this out of the box.

We have moved away from CocoaPods and Carthage, and are now using SPM, the Swift Package Manager. I did not expect that to be an issue since this now is part of Xcode, but I was wrong.

When running the pipeline, I got this error

/usr/bin/xcodebuild failed with return code: 74 
xcodebuild: error: Could not resolve package dependencies: 
 The server SSH fingerprint failed to verify

The solution that worked out for me was to add the Install SSH Key task, and follow the documentation found there.

The documentation tells us: Select the SSH key that was uploaded to Secure Files to install on the agent

You will find a tab under Library with the label Secure files. There you upload the private key, generated earlier.

The task that I added looks like this:

- task: InstallSSHKey@0
    knownHostsEntry: ', ssh-rsa AAAAB3....=='
    sshPublicKey: 'ssh-rsa AA...'
    sshPassphrase: '...'
    sshKeySecureFile: 'Your secure file added to Secure Files, under Libraries'