Xcode Server: load environment from ~/.bash_profile in prebuild/postbuild scripts

Originator:czechboy0
Number:rdar://22424243 Date Originated:25-Aug-2015
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 Beta 6, OS X Server 5.0 Beta 5
Classification: Reproducible:Always
 
Summary:
Script triggers currently have a very limited PATH variable, only pointing to system paths (/Applications/Xcode-7.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin). However, developers install tools like CocoaPods, Carthage, Fastlane, Ruby Gems for new Ruby versions, Homebrew etc into e.g. /usr/local/bin instead. These tools are not easily accessible from trigger scripts, because the PATH doesn't include this location.

It would be great if the _xcsbuildd user, before starting a script, loaded the environment from ~/.bash_profile (or ~/.profile or any other file) and merged it with the required environment for _xcsbuildd, so that developers can easily add more search paths (like /usr/local/bin). This would be useful also for providing custom environment variables, without the need to specify them again and again in every new trigger script.

Steps to Reproduce:
1. Install a new Ruby version with homebrew (will install in /usr/local)
2. Install cocoapods (sudo gem install cocoapods - will install in /usr/local/bin)
3. In your Bot's script, add "cd PROJECT_NAME; pod install;"


Expected Results:
Should work just fine.

Actual Results:
Will fail because it won't find the `pod` binary in any of the system search paths. Instead, it only lives in /usr/local/bin, which is not in PATH.

Version:
Xcode 7 Beta 6, OS X Server 5.0 Beta 5

Notes:

Configuration:
Would be useful for many use cases.

Comments

fastlane prebuild non-interactive mode

I follow your instruction to setup XCode Server (4 articles) at https://honzadvorsky.com/articles/2015-09-14-15-00-xcode_server_hacks_3_install_cli_tools_for_xcsbuildd/. When I run integration, it stop with the error below. Do you have any workaround for this, please help. Thanks in advance.

Assertion: Trigger script exited with code: 1 /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/commander-4.3.5/lib/commander/user_interaction.rb:334: warning: constant ::TimeoutError is deprecated /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane_core-0.46.2/lib/fastlane_core/ui/interface.rb:127:in `crash!': [!] Could not retrieve response as fastlane runs in non-interactive mode (FastlaneCore::Interface::FastlaneCrash) from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane_core-0.46.2/lib/fastlane_core/ui/implementations/shell.rb:119:in verify_interactive!' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane_core-0.46.2/lib/fastlane_core/ui/implementations/shell.rb:97:inconfirm' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane_core-0.46.2/lib/fastlane_core/ui/ui.rb:14:in method_missing' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/lib/fastlane/commands_generator.rb:245:inensure_fastfile' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/lib/fastlane/commands_generator.rb:46:in block (2 levels) in run' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/commander-4.3.5/lib/commander/command.rb:178:incall' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/commander-4.3.5/lib/commander/command.rb:153:in run' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/commander-4.3.5/lib/commander/runner.rb:428:inrun_active_command' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane_core-0.46.2/lib/fastlane_core/ui/fastlane_runner.rb:26:in run!' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/commander-4.3.5/lib/commander/delegates.rb:15:inrun!' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/lib/fastlane/commands_generator.rb:235:in run' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/lib/fastlane/commands_generator.rb:18:instart' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/lib/fastlane/cli_tools_distributor.rb:47:in take_off' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/gems/fastlane-1.94.0/bin/fastlane:5:in' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/bin/fastlane:23:in load' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/bin/fastlane:23:in

' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in eval' from /var/_xcsbuildd/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
' /var/folders/ng/yj9s4lkj05bdwgjgfdlz30tw000087/T/7B7F5555-BE83-4339-B68A-D1A29ACFACCB-44403-0000109432EE959E: line 6: shell_session_update: command not found

File: (null):(null)

Full logs for this integration are attached.

By andj.king at June 7, 2016, 1:30 a.m. (reply...)

Annoying issue

This is really an annoying issue. Please fix ASAP. We would love to use xcode bot more if this can't be easily done.

By superqichi at May 16, 2016, 6:19 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!