xcodereleases/xcinfo

Non Interactive Installation

Opened this issue · 6 comments

I'd like to integrate this into my CI system for generating a build machine VM. It'd be great if there was a way to install specific Xcode versions without prompting when multiple versions are found by being able to define exactly which version you want installed as the initial argument.
Also, finding a way to provide Apple Developer credentials as a separate command to run prior to the install step would be very helpful

That sounds great. Can you try to implement these features?

I'm also registering my interest for this feature. We regularly have to sideload older versions of Xcode as part of our automation pipeline, and this tool (when supervised) does an excellent job of doing just that.

I would give it a go, but I don't know Swift!

trispo commented

Hi. Thanks for your interest in this feature. I'd like to implement this but I don't know how to solve the 2FA. Any ideas?

Hi. Thanks for your interest in this feature. I'd like to implement this but I don't know how to solve the 2FA. Any ideas?

I wish I did! I hadn't considered that previously. Currently we are installing .xip from a S3 bucket to reduce reliance on third-party mirrors (like Apple's Developer portal), but even that requires needing to select between versions (if a version like 14.2 has a RC build as a secondary option).

Also, the other problem I noticed from reading the code (and taking a bit of a guess from my non-existent understanding of Swift), is that it doesn't check to see whether xcinfo is running as elevated, so it will always ask for super-user credentials. I think it would be good if it did that check ahead of time so it doesn't need to prompt the user.

It could be the case that the xcinfo process is launched using sudo, which might not require entering credentials if the logged-in user is either root or another super-user.

It would be enough for us to provision the build machine with authenticated credentials stored in the system's Keychain ahead of time, and do the remaining operations completely unattended as part of the automation pipeline (if that all makes sense! 🤞).

trispo commented

Hi @LoveDuckie, thanks for your answer. Did you notice that the new version offers to install Xcode from a previously downloaded XIP? You can download it once, put it on your S3 bucket and install it from there. This should be sufficient, shouldn't it?

For the sudo part, I guess I need some help from the community here. You're right, currently the app assumes not to run in super-user mode. I am not very much experienced in this CLI-tool programming and am not sure how to check this appropriately.

We could use getuid() from Darwin. When it returns 0 the user has root privileges.