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

Problem with Scan with new version from fastlane #20341

Closed
4 tasks done
ViniciusDeep opened this issue Jun 1, 2022 · 4 comments · Fixed by #21026
Closed
4 tasks done

Problem with Scan with new version from fastlane #20341

ViniciusDeep opened this issue Jun 1, 2022 · 4 comments · Fixed by #21026

Comments

@ViniciusDeep
Copy link

ViniciusDeep commented Jun 1, 2022

New Issue Checklist

Issue Description

We have to update the Fastlane 2.200.0 to 2.206.2

And Scan we have a problem with test, with 2.200.0 works fine, but in 2.206.2 we faced to: encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal kill before starting test execution. If you believe this error represents a bug, please attach the result bundle at /Users/vagrant/Library/Developer/Xcode/DerivedData/

Command executed

scan(
scheme: "#{proj[:scheme_dev]}",
skip_slack: true,
code_coverage: true,
derived_data_path: options[:derived_data_path],
clean: true,
fail_build: true
)

Complete output when running fastlane, including the stack trace and command used
 (Underlying Error: Test crashed with signal kill before starting test execution. If you believe this error represents a bug, please attach the result bundle at /Users/vagrant/Library/Developer/Xcode/DerivedData/ 

Environment

 
✅ fastlane environment ✅

Stack

Key Value
OS 12.4
Ruby 3.0.1
Bundler? true
Git git version 2.30.1 (Apple Git-130)
Installation Source ~/.rbenv/versions/3.0.1/bin/fastlane
Host macOS 12.4 (21F79)
Ruby Lib Dir ~/.rbenv/versions/3.0.1/lib
OpenSSL Version OpenSSL 1.1.1j 16 Feb 2021
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path ~/Desktop/Xcode.app/Contents/Developer/
Xcode Version 13.0
Swift Version 5.5

System Locale

Variable Value
LANG pt_BR.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
import_from_git(url: 'git@bitbucket.org:will-bank/will-ios-certificates.git', path: 'fastlane/will')

def url_repo
  "https://bitbucket.org/will-bank/will-ios"
end

def proj_name
  "WillBank"
end

def proj
  {
      plist: "./#{proj_name}/Info.plist",
      xcodeproj: "./#{proj_name}.xcodeproj/",
      workspace: "./#{proj_name}.xcworkspace",
      repo_url: "#{url_repo}",
      scheme_prod_beta: "#{proj_name}",
      scheme_dev: "#{proj_name}-DEV",
      scheme_stg: "#{proj_name}-STG",
      app_identifier_for_prod: "com.app.meupag",
      app_identifier_for_dev: "com.app.dev.meupag",
      app_identifiers: "com.app.meupag,com.app.dev.meupag"
  }
end

def config 
  {
    staging_release: "StagingRelease",
    production_relase: "ProductionRelease"
  }
end

default_platform(:ios)

platform :ios do 
  api_key = app_store_connect_api_key(
      key_id: "6HK47SC97F",
      issuer_id: "3e5c2d2e-ab93-4365-8834-bc0fcc1b0456",
      key_filepath: "./fastlane/AuthKey_6HK47SC97F.p8",
      in_house: false
    )

  #---------------------------- Certificate and Profiles Lanes --------------------------#
  private_lane :create_keychain_and_import_certificate do
    create_keychain(
      name: ENV['CI_KEYCHAIN_NAME'],
      password: ENV['CI_KEYCHAIN_PASSWORD'],
      default_keychain: true,
      unlock: true,
      timeout: 3600,
      lock_when_sleeps: false
    )

    apple_intermediate_certificate_path = "/tmp/AppleWWDRCAG3.cer"
    `curl https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer --output #{apple_intermediate_certificate_path}`
    
    import_certificate(
      certificate_path: apple_intermediate_certificate_path,
      keychain_name: ENV['CI_KEYCHAIN_NAME'],
      keychain_password: ENV['CI_KEYCHAIN_PASSWORD']
    )
  end
  
  private_lane :install_profile do |options| 
    readonly = options[:readonly] != false
    if is_ci
      create_keychain_and_import_certificate
      
      if options[:app_identifier]
        match(
          app_identifier: "#{options[:app_identifier]}",
          type: "#{options[:type]}",
          keychain_name: ENV['CI_KEYCHAIN_NAME'],
          keychain_password: ENV['CI_KEYCHAIN_PASSWORD'],
          readonly: readonly
        )
      else
        match(
          type: "#{options[:type]}",
          force_for_new_devices: true,
          keychain_name: ENV['CI_KEYCHAIN_NAME'],
          keychain_password: ENV['CI_KEYCHAIN_PASSWORD'],
          readonly: readonly
        )
      end          
    else
      if options[:app_identifier]
        match(
          app_identifier: "#{options[:app_identifier]}",
          type: "#{options[:type]}",
          readonly: readonly
        )
      else
        match(
          type: "#{options[:type]}",
          force_for_new_devices: true,
          readonly: readonly
        )
      end          
    end  
  end

  private_lane :match_all do |options|
    match(
      type: "appstore",
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      readonly: options[:readonly]
    )
    
    match(
      type: "adhoc",
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      readonly: options[:readonly],
      force_for_new_devices: true
    )    
    
    match(
      type: "development", 
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      readonly: options[:readonly],
      force_for_new_devices: true
    )
  end

  private_lane :create_certificates do |options|
    match(
      type: "appstore",
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      force: true
    )
    
    match(
      type: "development",
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      force: true
    )    
    
    match(
      type: "adhoc", 
      app_identifier: "#{proj[:app_identifiers]}",
      api_key: options[:api_key],
      force: true
    )
  end
  
  desc "Download profiles with readonly option"
  lane :tinder do |options|
    readonly = options[:readonly] != false
    match_all(readonly: readonly, api_key: api_key)    
  end

  #----------------------- Create all certificates after expired ------------------------#
  lane :update_certificates do
    create_certificates(api_key: api_key) 
  end

  #----------------------- Renew provisionning profiles ------------------------#
  
  desc "Renew provisionning profiles"
  lane :rematch do
    match_all(readonly: false, api_key: api_key) 
  end

   #----------------------- Testing lanes ------------------------#

   desc "Test report - xml to sonar" 
   lane :test_report_slather do |options|
    slather(
           build_directory: options[:derived_data_path]
        ) 
    end

   desc "Run test for scheme"
   lane :testing do |options|
     if (is_ci == true)
       reset_simulator_contents
     end

     scan(
      scheme: "#{proj[:scheme_dev]}",
      skip_slack: true,
      code_coverage: true,
      derived_data_path: options[:derived_data_path],
      output_directory: options[:derived_data_path],
      clean: true,
      fail_build: true
    )
   end

  #--------------------------- IPA Creation Lanes ---------------------------#
  
  private_lane :create_appstore_ipa do        
    gym(
      verbose: false,
      configuration: "#{config[:production_relase]}",
      scheme: "#{proj[:scheme_prod_beta]}",
      workspace: "#{proj[:workspace]}",
      silent: false,
      clean: true,
      xcargs: "ARCHIVE=YES" 
    )
  end

  private_lane :release_notes do |options|
    notes = "Version: #{options[:version_number]} Build: #{options[:build_number]}"
  end


  desc "Lane to publish feature always with 1.0.0 version number and your hash release"
  lane :feature_release_testing do |options|
    bump
    build_number = get_build_version
    version_number = "1.0.0"

    increment_version_number(
          version_number: version_number,
          xcodeproj: proj[:xcodeproj]
      )

    commit = last_git_commit
    author = commit[:author]
    short_hash = commit[:abbreviated_commit_hash] 
  
    note = author + " Disponibiizou versão: " +  version_number + " Em Stage para teste interno Build: " + build_number + " Hash: " + short_hash
    
    install_profile(
      app_identifier: proj[:app_identifier_for_dev],
      type: "appstore",
      readonly: options[:readonly]
    )    

    gym(
      verbose: false,
      configuration: "#{config[:staging_release]}",
      scheme: "#{proj[:scheme_stg]}",
      workspace: "#{proj[:workspace]}",
      silent: false,
      clean: true,
      xcargs: "ARCHIVE=YES" 
    )
    
    pilot(
      app_identifier: "com.app.dev.meupag",
      api_key: api_key,
      skip_submission: true, 
      skip_waiting_for_build_processing: true,
    )

    slack(
      message: note,
      success: true, 
      payload: {
        'Version' => get_version_short_string,
        'Build' => get_build_version,
      },
      attachment_properties: {
        thumb_url: "https://developer.apple.com/assets/elements/icons/testflight/testflight-64x64_2x.png",
      }
    )
  end 

  desc "Generate a Staging Build on TestFlight"
  lane :release_staging do |options|
    build_number = get_build_version
    version_number = get_version_short_string

    install_profile(
      app_identifier: proj[:app_identifier_for_dev],
      type: "appstore",
      readonly: options[:readonly]
    )    

    gym(
      verbose: false,
      configuration: "#{config[:staging_release]}",
      scheme: "#{proj[:scheme_stg]}",
      workspace: "#{proj[:workspace]}",
      silent: false,
      clean: true,
      xcargs: "ARCHIVE=YES" 
    )
    
    pilot(
      app_identifier: "com.app.dev.meupag",
      api_key: api_key,
      skip_submission: true, 
      skip_waiting_for_build_processing: true
    )
  end

  #----------------------- Testflight lanes ------------------------#
  desc "Generate a production build on TestFlight"
  lane :release_prod do |options|
    build_number = get_build_version
    version_number = get_version_short_string

    install_profile(
      app_identifier: proj[:app_identifier_for_prod],
      type: "appstore",
      readonly: options[:readonly]
    )    

    create_appstore_ipa
    
    pilot(
      api_key: api_key,
      skip_submission: true, 
      skip_waiting_for_build_processing: true
    )
    
  end


  desc "Generate Staging and Beta version on Testflight"
  lane :release_train do |options|
    bump
    release_staging
    release_prod

    slack(
      message: "Publish release train on TestFlight",
      success: true, 
      payload: {
        'Version' => get_version_short_string,
        'Build' => get_build_version,
      },
      attachment_properties: {
        thumb_url: "https://developer.apple.com/assets/elements/icons/testflight/testflight-64x64_2x.png",
      }
    )
  end

  desc "Lane to start process at release-train changing minor"
  lane :start_release_train do 
    minor 
    bump 
    checkout_release_to_a_branch_version
    sh "git commit -am \"⬆️ Bump: Version Number version: #{get_version_short_string} \""
    sh "git tag -a #{get_version_short_string}-rc -m \"⬆️ Bump: Build version: #{get_version_short_string} \""
  
    if is_ci 
      push_to_git_remote
    end
  end 

  desc "Lane to start process at release-train changing major"
  lane :start_release_train_with_major_version do 
    major 
    bump 
    checkout_release_to_a_branch_version
    sh "git commit -am \"⬆️ Bump: Version Number version: #{get_version_short_string} \""
    sh "git tag -a #{get_version_short_string}-rc -m \"⬆️ Bump: Build version: #{get_version_short_string} \""
  
    if is_ci 
      push_to_git_remote
    end
  end

  desc "Lane to start process at hotfix changing patch"
  lane :release_hotfix do 
    patch 
    bump
    release_prod

    slack(
      message: "Publish a hotfix on TestFlight",
      success: true, 
      payload: {
        'Version' => get_version_short_string,
        'Build' => get_build_version,
      },
      attachment_properties: {
        thumb_url: "https://developer.apple.com/assets/elements/icons/testflight/testflight-64x64_2x.png",
      }
    )
  end

  desc "Clean artifacts eg: profile, ipa"
  lane :clean_artifacts do 
    clean_build_artifacts
  end

  #---------------------------------- Versioning lanes ----------------------------------#
  
  private_lane :update_version_number_and_commit do |options|
    new_version_number = options[:number]
    bump_type = options[:bump_type]
    
    if (proj[:xcodeproj] == nil)
      raise "Your fastlane File is missing a xcodeproj variable: proj[:xcodeproj] = './PATH_TO_PROJECT.xcodeproj/' ".red
    end
    
    if proj[:xcodeproj]
      
      if new_version_number
        increment_version_number(
          version_number: new_version_number,
          xcodeproj: proj[:xcodeproj]
        )
      elsif bump_type
        increment_version_number(
          bump_type: bump_type,
          xcodeproj: proj[:xcodeproj]
        )
      else
        increment_version_number(xcodeproj: proj[:xcodeproj])
      end
      
      version_number = get_version_short_string
      sh "git commit -am \"⬆️ Bump: version number: #{version_number} \" "
      version_number
    end
  end

  desc "Increment Major version Major.x.x and commit"
  lane :major do
    version_number = update_version_number_and_commit(bump_type:"major")
    version_number
  end

  desc "Increment Minor version x.Minor.x and commit"
  lane :minor do
    version_number = update_version_number_and_commit(bump_type:"minor")
    version_number
  end

  desc "Increment Patch version x.x.Patch and commit"
  lane :patch do
    version_number = update_version_number_and_commit(bump_type:"patch")
    version_number
  end
  
  private_lane :checkout_release_to_a_branch_version do 
    sh "git checkout -b release/#{get_version_short_string}"
  end

  desc "Launch tag with a version number"
  lane :launch_prod_tag do 
    bump
    sh "git checkout -b backup-master/#{get_version_short_string}"
    sh "git commit -am \"⬆️ Bump: Version Number version: #{get_version_short_string} \""
    sh "git tag -a #{get_version_short_string} -m \"⬆️ Bump: Build version: #{get_version_short_string} \""

    if is_ci 
      push_to_git_remote(
        tags: true
      )
    end
  end 
  
  desc "Increment Build Number x.x.x (Build) and commit"
  lane :bump do
    time_now = Time.now.strftime("%Y%m%d%H%M")
    increment_build_number(build_number: time_now)
  end

  #----------------------- Utils ------------------------#
  def get_version_short_string
    if (proj[:plist] == nil)
      raise "Your fastlane File is missing a plist variable: proj[:plist] = './PATH_TO_PROJECT/Info.plist' ".red
    end
    get_info_plist_value(path: proj[:plist], key: 'CFBundleShortVersionString')
  end

  def get_build_version
    if (proj[:plist] == nil)
      raise "Your fastlane File is missing a plist variable: proj[:plist] = './PATH_TO_PROJECT/Info.plist' ".red
    end
    get_info_plist_value(path: proj[:plist], key: 'CFBundleVersion')
  end

  after_each() do |lane, _|
    message = "Running lane `#{lane}` finished successfully! 🎉"

    notification(message: message)
  end

  error() do |lane, exception, _|
    message = "Running lane `#{lane}` finished with errors! ⛔️"

    notification(message: "Exception: #{exception}", subtitle: message)
  end

end
`./fastlane/Appfile`
app_identifier "com.app.meupag" # The bundle identifier of your app
apple_id "mobileadmin@meupag.com.br" # Your Apple email address

itc_team_id "119274703" # App Store Connect Team ID
team_id "C8Q9PQS2B8" # Developer Portal Team ID


# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.206.2 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-firebase_app_distribution 0.3.4 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.5.0
bundler 2.2.15
tsort 0.1.0
uri 0.10.1
pathname 0.1.0
rake 13.0.6
rexml 3.2.5
CFPropertyList 3.0.5
concurrent-ruby 1.1.10
i18n 1.10.0
minitest 5.15.0
thread_safe 0.3.6
tzinfo 1.2.9
activesupport 5.2.8
public_suffix 4.0.7
addressable 2.8.0
httpclient 2.8.3
json 2.6.2
algoliasearch 1.27.5
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.2.0
aws-partitions 1.595.0
aws-sigv4 1.5.0
jmespath 1.6.1
aws-sdk-core 3.131.1
aws-sdk-kms 1.57.0
aws-sdk-s3 1.114.0
babosa 1.0.4
claide 1.1.0
clamp 1.3.2
fuzzy_match 2.0.4
nap 1.1.0
netrc 0.11.0
ffi 1.15.5
ethon 0.15.0
typhoeus 1.4.0
cocoapods-core 1.10.1
cocoapods-deintegrate 1.0.5
cocoapods-downloader 1.6.3
cocoapods-plugins 1.0.0
cocoapods-search 1.0.1
cocoapods-trunk 1.6.0
cocoapods-try 1.2.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.3.1
gh_inspector 1.1.3
molinillo 0.6.6
ruby-macho 1.4.0
nanaimo 0.3.0
xcodeproj 1.21.0
cocoapods 1.10.1
colored 1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.4
unf_ext 0.0.8.2
unf 0.1.4
domain_name 0.5.20190701
dotenv 2.7.6
emoji_regex 3.2.3
excon 0.92.3
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
multipart-post 2.0.0
faraday-multipart 1.0.3
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
ruby2_keywords 0.0.5
faraday 1.10.0
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.6
jwt 2.3.0
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.16.1
googleauth 1.1.3
mini_mime 1.1.2
trailblazer-option 0.1.2
uber 0.1.0
representable 3.2.0
retriable 3.1.2
webrick 1.7.0
google-apis-core 0.5.0
google-apis-androidpublisher_v3 0.21.0
google-apis-playcustomapp_v1 0.7.0
google-apis-iamcredentials_v1 0.10.0
google-apis-storage_v1 0.14.0
google-cloud-env 1.6.0
google-cloud-errors 1.2.0
google-cloud-core 1.6.0
google-cloud-storage 1.36.2
mini_magick 4.11.0
naturally 2.2.1
optparse 0.1.1
plist 3.6.0
rubyzip 2.3.2
security 0.1.3
simctl 1.6.8
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
fastlane-plugin-firebase_app_distribution 0.3.4
racc 1.6.0
nokogiri 1.13.6
slather 2.7.2

generated on: 2022-06-01

@fastlane-bot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself 💪

This issue will be auto-closed if there is no reply within 1 month.

@fastlane-bot
Copy link

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@testableapple
Copy link
Contributor

Hey @ViniciusDeep, have you fixed the issue, or has it just gone for you?
It still pops up sometimes for me on CI on fastlane 2.211.0.

@rogerluan
Copy link
Member

Reopening this issue and linking it to #21026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants