I think the new version of the credential plugin now first removes all existing keychains with the corresponding name before importing, as shown in the log output below.
$ security delete-keychain jenkins-MyAppsBuildName-iOS $ security create-keychain -p ******** jenkins-MyAppsBuildName-iOS $ security unlock-keychain -p ******** jenkins-MyAppsBuildName-iOS
Because of this, I donβt think you will have a problem with duplicate errors in the keychain in the second run.
Since the problem with the initialization profile was not found, add the following line inside the run shell command and run the jenkins build.
security list-keychains
Take a look at the console for this particular assembly, and you will see a list of all the key chains that are currently in the shell area.
If you do not see "jenkins-MyAppsBuildName-iOS" as a list of keys, this is why you have a signature problem. Since the keychain is not listed, it is not even scanned to find the correct subscription ID / profile.
Solution: Warning: Hacking
I am not 100% sure why this is happening, but from other threads this is a permission issue.
Fortunately, there is an easy way.
At the execute command line, add the following:
security list-keychain -s jenkins-${JOB_NAME}
This will reset the list of keychains to include the keychains needed to successfully build the project.
To make sure that the relevant keywords are listed, you can add the following lines to the shell command:
security list-keychain security list-keychain -s jenkins-${JOB_NAME} security list-keychain
Now compare the output of the first list-keychain command with the second list-keychain command in the console. Make sure the key chain for creating jenkin is listed after the second exit of the list of security keys.
Warning: This constantly changes the list of keys in the system, so it is probably a good idea to reset the keychain after the build is complete. You can accomplish this by setting the default values ββof the required keys in the xcode configuration inside the Jenkin System Configuration section. After that, check the box "Restore OS X keychains after the build process as defined in the global configuration" in the build environment inside the Jenkins work page.
Additional information: In my example, I set up a list of keys to include only the keyword created by Jenkins, but you can also enable the standard system and login by changing the line as such:
security list-keychain -s jenkins-${JOB_NAME} login.keychain System.keychain
Keywords: Jenkins, iOS, slave, node, Xcode, plugin, credentials, .developerprofile