getsentry / sentry-fastlane-plugin

Official fastlane plugin for Sentry
https://sentry.io
MIT License
136 stars 50 forks source link

sentry-cli-Darwin-universal: 2: Syntax error: word unexpected (expecting ")") when running on circleCI Android image #161

Closed matt-dalton closed 2 years ago

matt-dalton commented 2 years ago

Environment

v1.13.0 I'm running on the following circleCI image:

docker:
   - image: cimg/android:2022.06.1-node
    resource_class: xlarge

Locally and on version 1.12.2, everything works fine.

If I ssh into the image and run arch it returns x86_64

Relevant Fastfile lane:

lane :upload_sentry_artifacts do |options|
  sentry_check_cli_installed()
  sentry_release_name = options[:sentry_release_name]
  platform = options[:platform]
  project_slug = ENV['SENTRY_PROJECT_SLUG']

  if sentry_release_name.nil?
    UI.user_error!("Sentry release version not specified")
  end

  source_map_path = ENV['ANDROID_SENTRY_SOURCEMAP_LOCATION']
  bundle_path = ENV['ANDROID_SENTRY_BUNDLE_LOCATION']
  dist_version = ENV['ANDROID_VERSION_BUILD_NUMBER']
  app_identifier = ENV['ANDROID_APP_ID']
  sourcemap_location = ENV['ANDROID_SENTRY_SOURCEMAP_LOCATION']
  outfile = '~/index.android.bundle'

  sentry_create_release(
    version: sentry_release_name,
    finalize: false
  )

  sentry_upload_file(
      version: sentry_release_name,
      dist: dist_version,
      file: bundle_path,
      file_url: outfile
  )

  sentry_upload_sourcemap(
      version: sentry_release_name,
      dist: dist_version, 
      sourcemap: sourcemap_location
  )
end

CircleCI steps:

        steps:
            - attach_workspace:
                  at: ~/
            - ruby/install-deps
            - run:
                  command: |
                      bundle install --path=vendor/bundle --jobs=4 --retry=3
            - save_cache:
                  key: bundle-v2-{{ checksum "./Gemfile.lock" }}-{{ arch }}
                  paths:
                      - ~/.bundle/
                      - /Users/distiller/.gem/ruby/2.4.5/
                      - ./vendor/bundle
            - run:
                  name: Build & Deploy
                  command: |
                      bundle exec fastlane android deploy -e << parameters.environment >>

Steps to Reproduce

Locally my Fastfile works fine. When I run on the circleCI job above I get this error:

[19:59:51]: ------------------------------------------------------------
[19:59:51]: --- Step: Switch to android upload_sentry_artifacts lane ---
[19:59:51]: ------------------------------------------------------------
[19:59:51]: Cruising over to lane 'android upload_sentry_artifacts' 🚖
[19:59:51]: -----------------------------------
[19:59:51]: --- Step: sentry_create_release ---
[19:59:51]: -----------------------------------
/home/circleci/myapp/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-sentry-1.13.0/bin/sentry-cli-Darwin-universal: 2: Syntax error: word unexpected (expecting ")")
/home/circleci/myapp/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-sentry-1.13.0/bin/sentry-cli-Darwin-universal: 2: Syntax error: word unexpected (expecting ")")
[19:59:51]: Using sentry-cli 
[19:59:51]: Starting sentry-cli...
[19:59:51]: /home/circleci/myapp/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-sentry-1.13.0/bin/sentry-cli-Darwin-universal: 2: Syntax error: word unexpected (expecting ")")
[19:59:51]: --------------------------------------------------
[19:59:51]: --- Step: Switch to android restore_files lane ---
[19:59:51]: -------------------------------------------------

If I run with Sentry debug logging I don't get any additional information

Expected Result

It works as it does locally and on version 1.12.2

Is there anything else I can do to understand this error more? Any ideas what it could be?

philipphofmann commented 2 years ago

@denrase, do you have any clue what could cause this?

denrase commented 2 years ago

Huh, looks like the we are assuming the wrong architecture in this circumstance. I will check this out. Thanks @matt-dalton for bringing this up and sorry for the inconvenience.

denrase commented 2 years ago

@matt-dalton In the meantime, you could either continue using 1.12.2 or provide the path to a sentry-cli installation with the sentry_cli_path parameter.

denrase commented 2 years ago

Hey @matt-dalton, we have created an alpha beta release where more architectures of sentry-cli are bundled with the gem. Could you check if this solves your issue?

https://github.com/getsentry/sentry-fastlane-plugin/releases/tag/1.13.1

matt-dalton commented 2 years ago

Just managed to test, and it seems this now works. Thanks!