Error using Bugsnag symbol upload build phase


#1

Hey there,

I’m incorporating Bugsnag into a project that’s already been building on CircleCI. They suggested adding the following as a Run Script build phase (using /usr/bin/ruby):

fork do
  Process.setsid
  STDIN.reopen("/dev/null")
  STDOUT.reopen("/dev/null", "a")
  STDERR.reopen("/dev/null", "a")

  require 'shellwords'

  Dir["#{ENV["DWARF_DSYM_FOLDER_PATH"]}/*/Contents/Resources/DWARF/*"].each do |dsym|
    system("curl -F dsym=@#{Shellwords.escape(dsym)} -F projectRoot=#{Shellwords.escape(ENV["PROJECT_DIR"])} https://upload.bugsnag.com/")
  end
end

(see here: https://docs.bugsnag.com/platforms/tvos-objc/symbolication-guide/)

Seems more or less straightforward enough - find the dsyms and curl them to Bugsnag. When I run it, I get an error at that point on the CircleCI image:

/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:179:in `rescue in specs': Your bundle is locked to CFPropertyList (2.3.4), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of CFPropertyList (2.3.4) has removed it. You'll need to update your bundle to a different version of CFPropertyList (2.3.4) that hasn't been removed in order to install. (Bundler::GemNotFound)
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:173:in `specs'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:233:in `specs_for'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:222:in `requested_specs'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:118:in `block in definition_method'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:19:in `setup'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:99:in `setup'
	from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/setup.rb:20:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Command /bin/sh failed with exit code 1

I’m not a ruby pro, so I’m not sure what needs to happen here in order to get this working. Do I need to update the CFPropertyList gem on the system? In my own bundle? Use my own bundle instead of the system Ruby? Any advice would be helpful. Thanks!

–Andy


#2

I was able to solve this issue. I’m not 100% what was going on, but it seems like explicitly referring to /usr/bin/ruby as the shell for this command was using the system ruby and not the version specified by chruby, even though it was on the $PATH.

My solution was to put the body of the script into a separate file in a BuildPhaseScripts directory and have the build phase use /bin/sh to just do

ruby ./BuildPhaseScripts/upload_dsyms_to_bugsnag.rb

Since the proper ruby version was on the path, that’s the one that was used. I’ll let the Bugsnag folks know that they might want to suggest this for CI environments.


#3

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.