Skip to content

Conversation

bramschulting
Copy link
Contributor

@bramschulting bramschulting commented Mar 7, 2025

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

Before this change it was impossible to provide a name param to the create_keychain action which is called by the setup_ci action. This change adds a keychain_name param to the setup_ci action which will be passed as name to the create_keychain action.

We use a self hosted MacOS GitHub Actions runner which can run multiple jobs in parallel. When the setup is started twice (or more) exactly at the same time, the creation of the keychain sometimes fails in one of the jobs with the following error:

/Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!': [!] Shell command exited with exit status 48 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:in `sh'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/actions/create_keychain.rb:28:in `run'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/actions/setup_ci.rb:42:in `setup_keychain'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/actions/setup_ci.rb:15:in `run'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
	from Fastfile:29:in `block (2 levels) in parsing_binding'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:291:in `execute_flow_block'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:46:in `block in execute'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/gems/fastlane-2.225.0/bin/fastlane:23:in `<top (required)>'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/bin/fastlane:25:in `load'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/bin/fastlane:25:in `<main>'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/bin/ruby_executable_hooks:22:in `eval'
	from /Users/githubrunner/.rvm/gems/ruby-3.2.3/bin/ruby_executable_hooks:22:in `<main>'

This happens because of a timing issue where the first job creates the keychain before the second job is able to tell this happened and subsequently also tries to create the keychain.

To mitigate this issue, we would like to give each job its own keychain (which is actually preferred for other reason too). But currently the setup_ci action does not allow us to do this.

Description

The setup_ci action has a new keychain_name param which is used as the name param of the create_keychain action.

Before this commit it was impossible to provide a `name` param to the `create_keychain` action which is called by the `setup_ci` action. This commit adds a `keychain_name` param to the `setup_ci` action which will be passed as `name` to the `create_keychain` action.
@bramschulting
Copy link
Contributor Author

I've not checked off the bundle exec rspec item, because the following test is failing for me:

rspec ./gym/spec/platform_detection_spec.rb:28 # Gym detects the correct platform for a visionOS project

This test also fail for me on the master branch, so I presume this has something with my local setup.

Please let me know if I can check it off if it succeeds on the CI.

It seems like some more setup was needed for the tests to pass on the CI. By moving the test, the setup should already be done.
@AliSoftware
Copy link
Contributor

rspec ./gym/spec/platform_detection_spec.rb:28 # Gym detects the correct platform for a visionOS project

This test also fail for me on the master branch, so I presume this has something with my local setup.

Yeah this happens to me as well if I don't have the visionOS SDK installed locally I think. But it passed on CI so I think it's ok 🙂

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

Sweet and to the point, perfect 👍

@AliSoftware AliSoftware merged commit c7da139 into fastlane:master Mar 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants