spotify / XCRemoteCache

Other
827 stars 50 forks source link

Do not rewrite user.rcinfo file during `xcprepare integrate` phase #114

Closed devMEremenko closed 2 years ago

devMEremenko commented 2 years ago

Hi XCRemoteCache Team,

Context As far as I understand, the main objective of user.rcinfo is to override settings in the .rcinfo. I use user.rcinfo to store some custom values locally. However, the xcprepare integrate operation fully rewrites user.rcinfo and drops custom values.

Actual behavior XCRemoteCache fully rewrites content of the user.rcinfo during:

Expected/desired behavior

Additionally, if a user provides a custom value to the extra_configuration_file field in .rcinfo file, can XCRemoteCache create one if user.rcinfo does not exist?

Relevant integration setup

[ ] CocoaPods cocoapods-xcremotecache plugin [X] Automatic integration using xcprepare integrate ... [ ] Manual integration [ ] Carthage

polac24 commented 2 years ago

What kind of entries you store in user.rcinfo? Is that a user preference of a repo-specific setup? I assume the former as otherwise, that property could land in .rcinfo.

I am not fully convinced that we should change the behavior now - some uses may already depend on it. What do you think about loading a global preference from ~/.rcinfo? Such user-default file is widely used in many other technologies like git, lldb or shell.

devMEremenko commented 2 years ago

Hi @polac24,

I used user.rcinfo to store temporary AWS credentials (aka aws_security_token, aws_secret_key, and aws_access_key).

What do you think about loading a global preference from ~/.rcinfo?

That makes sense on the one hand, but users may want to use different credentials per project on the other one.

As a workaround: I added .rcinfo to the git ignore to exclude tracking credentials and re-generated this file locally with all corresponding fields once a script that obtains temporary AWS credentials is completed.

polac24 commented 2 years ago

I agree, a case like yours doesn't play nicely with ~/.rcinfo.

Because I am afraid that relentlessly merging .rcinfo might lead to leftovers, let me suggest chaining .rcinfo. In your case you will have:

Then xcprepare integrate ... will add a clean file to user.rcinfo (or any other file you specify the chained configuration) and all commands will chain it (in this example: .rcinfo -> credentials.info -> user.rcinfo)

I prepared #117, would that work for you?

devMEremenko commented 2 years ago

@polac24, the composition of content should work great 👍

Could you please confirm that xcprepare integrate will only update corresponding fields in the user.rcinfo (such as mode, recommended_cache_address, and xccc_file), but credentials.rcinfo will not be changed?

polac24 commented 2 years ago

That is correct.

In the example above, XCRemoteCache will leave file credentials.rcinfo intact and place only 3 entries (mode, recommended_cache_address, and xccc_file) in user.rcinfo.