Can't find certificate for signing of iOS build

Hi! I’m using drone with exec runner for the automation of Unity3d iOS builds. I’ve written some command lines that need to executed on the machine in order to upload the build to testflight. The thing is, drone can’t find the certificate needed for signing on my machine (where drone is running). I’ve used the same commands on mac terminal and it works (it does find the certificate) smoothly and I have all certificates or provisioning profiles that are required, on my machine. The keychain is unlocked and I also tried unlocking the keychain through a command. When using this command security find-identity -v -p codesigning on terminal it shows me a valid certificate but on drone it says 0 valid certificates found. I’m attaching an image that shows what kind of error I’m facing plus I’ve been stuck on this for days and would really appreciate any help, Thanks.

I am not an iOS developer, however, one thing I would suggest is that you provide more details about what root causes you have investigated and ruled out. Someone is likely going to see this issue and run through a checklist of possible root causes. Since ou have been stuck on this for days, I presume you have already ruled out many root causes. Proactively providing this information might help others help you.

Okay so I’m manually trying to archive an xcode project and it involves some basic command lines. I don’t understand what exactly you need to know by saying root causes. I don’t think the issue is on iOS side, it’s the exec runner probably not able to find certificates on the machine for some reason. I tried looking into documentation but couldn’t find anything related to this.

when I google this error I see many search results for fixes:

I presume you have done research and read these links and tried these fixes and they did not work? I am only suggesting you tell people what you have tried and did not work. This way people do not spend time giving advice you already tried.

I think you’re not getting what I am trying to say. The issue only occurs on a drone pipeline. The bash command that I use to archive my project, when used on mac terminal works but when run through a drone pipeline it doesn’t. Hope that makes it clear :slight_smile:

I understand what you are saying. I am trying to find out if you ran through some common issues already. Are you setting the correct HOME directory in the pipeline so it can read the keychain file in your ~/Library/Keychains folder? Did you check to make sure the pipeline is executing commands using the correct osx user account (e.g. run whoami inside your pipeline)? Do you need to pass the fully qualified keychain path to the command as shown here? What debugging have you done and what were the results?

Okay so I’ve tried a command to unlock the keychain before archiving since I thought maybe that might be the issue but it wasn’t. As far as whoami command is concerned, it points to correct user account. I don’t understand what you mean by setting the HOME but the command I use for archiving finds the certificate by itself since the name of the certificate is mentioned as a parameter to that command.

Drone creates a temporary HOME directory for each pipeline to avoid mutating dotfiles in the user’s default home. This can have an impact on programs or processes that use the HOME directory, especially programs that need access to user’s keychain.

We therefore ask that you set the HOME directory in your pipeline and report back the results. This should be easy to test and will help us rule out a potential root cause.

- name: foo
  - export HOME=/path/to/home
  - ...

- name: bar
  - export HOME=/path/to/home
  - ...