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

Can't give travis machine keychain access #166

Open
loudmouth opened this issue May 9, 2017 · 9 comments
Open

Can't give travis machine keychain access #166

loudmouth opened this issue May 9, 2017 · 9 comments

Comments

@loudmouth
Copy link

When running my tests on travis, after setting my key with cocoapods keys and running bundle exec pod install, for some reason the header files for my Keys are not found during compilation.

My best guess as to why this is happening is that I am unable to give Ruby keychain access—the reason that I have made this assumption is that with a freshly installed Ruby, my own machine gives me a UI prompt to give access when running bundle exec pod install

Is there something I am missing here in my use of cocoapods-keys? Or do I need to investigate scripting the enabling of keychain access?

@marcelofabri
Copy link
Contributor

Maybe you should use ENV vars on CI so you don't actually need the keychain?

From README:

It's rarely a good idea to mess around with the keychain in your CI, so keys will look for an environment var with the same string before looking in the keychain. Also you could create a .env file in your project folder.

@loudmouth
Copy link
Author

Hey @marcelofabri, thanks for the quick reply.

I of course did have environment variables encrypted in travis, but they did not have the same name as the key. One thing that I'm unclear on from this snippet of the README, which I had originally missed, is do I need to call pod keys set ... ... in the case that an environment variable with the same name exists?

@marcelofabri
Copy link
Contributor

marcelofabri commented May 9, 2017

I don't this it's needed - see the circle.yml from Artsy

@loudmouth
Copy link
Author

I have successfully witnessed cocoapods-key use a local environment variable on my own machine instead of using a key in the keychain. To test this, I deleted the Pods/ directory, deleted the relevant keychain key, and ran pod install. This correctly generated a working header file with the relevant key.

However, despite the fact that I have now encrypted my variable in travis with the same variable name as the key name, these header files are still missing during compilation in Travis. I'm not quite sure how to proceed at this point. The logs for the branch I am testing are here specifically for the job in the build with CONTENFUL_SDK='CMA'

@loudmouth
Copy link
Author

@marcelofabri I don't fully understand the circle.yml file as I have never used circle before. What does from_admin indicate in this case?

@loudmouth
Copy link
Author

I found out the reason for my missing header files:

While debugging, I frequently cleared key(s) from my machine with bundle exec pod keys rm $KeyName; then deintegrated, cleaned, and reinstalled pods to try to mimic a fresh travis environment. I finally tried doing everything with a truly fresh environment on another computer. I soon found out that the header files generated by cocoapods-keys had different names on the two different machines. After reading issue #151 (also about inconsistent header names) I tracked down the yml file(s) that lived in the ~/.cocoapods/keys directory. Once I deleted the yml file(s), then reinstalled, the header files were given consistent naming. My headers are now found by the travis machines.

I would have expected rm keys to clear the associated yml file but instead I observed:

$ bundle exec pod keys rm KeyName
[!] Removed value for ManagementAPIAccessToken, and deleted associated key in Keychain.
$ ls ~/.cocoapods/keys/
14440bd08baddf719269311b94ff03cc.yml

Is this the expected behavior of keys rm?

@orta
Copy link
Owner

orta commented Jun 22, 2017

I don't think anyone really thought of deleting the yml file once all keys were removed, welcome to have that added 👍

@pavankatariaog
Copy link

Hi, has the removal of the yml file been added since?

@orta
Copy link
Owner

orta commented Jul 12, 2019

Nope, you're welcome to take a look

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

No branches or pull requests

4 participants