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

Add support for Apple API sessions from Fastlane Spaceship #257

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

adamprice
Copy link
Contributor

@adamprice adamprice commented Dec 13, 2022

As I use fastlane and xcodes, I thought it could be cool if xcodes could use the same Apple API auth session as fastlane to avoid having to authenticate twice.

I've added two new command line options:

--use-fastlane-auth # enable/disable feature, default off
--fastlane-user # fastlane spaceship user, uses FASTLANE_SESSION env var if none provided

With this mode enabled, cookies are copied from either the FASTLANE_SESSION environment variable or ~/.fastlane/spaceship/<user>/cookie file into an ephemeral URLSessionConfiguration that's then used for creating a URLSession to send requests. It also works with the way cookies are copied into the request for aria2. Hopefully this should stop the cookies from conficting with any existing sessions present in xcodes and they wont persist after the application has exited.

The current implementation is obviously coupled with how fastlane handles its cookies. As there's also a fastlane action for xcodes (https://docs.fastlane.tools/actions/xcodes/), another option could be coming up with a tool agnostic format for the cookies that the fastlane action can provide to xcodes.

@adamprice adamprice requested a review from a team as a code owner December 13, 2022 21:19
@adamprice adamprice marked this pull request as draft December 13, 2022 21:48
@tahirmt
Copy link
Contributor

tahirmt commented Dec 15, 2022

This is such a great idea! Something I tinkered with in the past but used ruby to achieve it. I do hope this gets in.

Copy link

@dgilbert-foreflight dgilbert-foreflight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Is this ready or still being drafted?

@adamprice
Copy link
Contributor Author

I'll update in the next couple of days and then remove the draft status.

@adamprice adamprice marked this pull request as ready for review January 30, 2023 12:18
@ykhandelwal913
Copy link

@adamprice @tahirmt Is this ready for merge? This will solve the issue with CI environment

Copy link
Contributor

@tahirmt tahirmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but we need a review from @MattKiazyk

Sources/XcodesKit/Environment.swift Outdated Show resolved Hide resolved
@ykhandelwal913
Copy link

@MattKiazyk can you please review this. This is very much needed as we are planning to migrate from xcversion to xcodes in our ci environment. xcodes seems to be very fast.

@MattKiazyk
Copy link
Contributor

@ykhandelwal913 I'll try to find some time this weekend to get it through. Sorry for the delay

Copy link
Contributor

@MattKiazyk MattKiazyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the time and contribution @adamprice!

Just a couple of picky additions to make the error messages stand out in the console!

Thanks again - sorry for the delay!

Sources/XcodesKit/FastlaneSessionManager.swift Outdated Show resolved Hide resolved
@MattKiazyk MattKiazyk added the enhancement New feature or request label Feb 11, 2023
@ykhandelwal913
Copy link

ykhandelwal913 commented Feb 11, 2023

@MattKiazyk thanks for looking into it. Are you planning to merge and release a new version of xcodes or it this waiting for some other change?

@ykhandelwal913
Copy link

ykhandelwal913 commented Feb 12, 2023

@MattKiazyk @adamprice can that be merged?

@ykhandelwal913
Copy link

@MattKiazyk we have a big dependency on fastlane session to migrate to xcodes. Can this PR request be merge if all checks are ok?

@MattKiazyk MattKiazyk merged commit 64dfa82 into XcodesOrg:main Feb 14, 2023
@MattKiazyk
Copy link
Contributor

Thanks @adamprice for all the work!

@ykhandelwal913 this will be in the next version. However, I don't have a specific timeline on when that will be.

@adamprice adamprice deleted the fastlane_session_support branch February 14, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants