fastlane: Match + Gym + Deliver doesn't use correct provisioning profile.

New Issue Checklist

Issue Description

When running a lane which invokes match, builds via gym and then uses deliver. I get an error from iTunes Connect that the IPA was uploaded with a development provisioning profile. I opened up the IPA and sure enougth it was.

On inspection I discovered my default certificate type in my matchfile was development so I change that to appstore. This then updated the SIGH certificate type to app-store.

However I still got the same error. I then made match only download the certificates for the appstore, incase gym was pulling in the incorrect type.

Again even though the SIGH certificate type was for the appstore and the matchfile species appstore as the default, gym and deliver seems to be building a IPA with a development provisioning profile.

This is especially odd considering gym is building a release scheme.

Complete output when running fastlane, including the stack trace and command used

Command ran fastlane deploy

Log.txt

Configuration Files

Please copy the complete content of your Fastfile and any other configuration files you use below:

Fastfile:

# Customise this file, documentation can be found here:
# https://github.com/KrauseFx/fastlane/tree/master/docs
# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# By default, fastlane will send which actions are used
# No personal data is shared, more information on https://github.com/fastlane/enhancer
# Uncomment the following line to opt out
# opt_out_usage

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.89.0"

####### TODO #######

# - Check user is in correct branch
# - Implement Git workflow into Lanes (i.e tagging and generating release branch)
# - Reduce length of change log

####### Settings #######

APP_IDENTIFIER = "com.forever-beta.sup"
CRASHLYTICS_API_KEY = <redacted>
CRASHLYTICS_BUILD_SECRET = <redacted>
CRASHLYTICS_PATH = "./Pods/Crashlytics/Crashlytics.framework"
IPA_PATH = "./Sup.ipa"
SLACK_URL = <redacted>

####### Methods #######

def inform_team(message)
  return if Helper.is_ci?

  slack(
    message: message,
    default_payloads: [],
    channel: "#ios"
  )
end

def setup_enviroment_variables
  ENV["SLACK_URL"] = SLACK_URL

  # Turn on workaround for https://github.com/CocoaPods/CocoaPods/issues/4178
  ENV["GYM_USE_GENERIC_ARCHIVE_FIX"] = "1"

  # Turn on workaround for https://github.com/CocoaPods/CocoaPods/issues/4178
  ENV["FASTLANE_EXPLICIT_OPEN_SIMULATOR"] = "1"
end

def setup_project
  inform_team("Generating Project And Installing Dependencies")
  xcake2
end

def install_fix_code_xcode_plugin
  # Install the FixCode plugin so that developers know we use match and not to
  # use `Fix Issue` inside of Xcode
  install_xcode_plugin(
    url: "https://github.com/fastlane/FixCode/releases/download/0.2.0/FixCode.xcplugin.zip"
  )
end

def download_certificate_and_profile(type, newDevices = false)
  match(app_identifier: APP_IDENTIFIER, type: type, force_for_new_devices: newDevices)
  match(app_identifier: "#{APP_IDENTIFIER}.watchkitapp", type: type, force_for_new_devices: newDevices)
  match(app_identifier: "#{APP_IDENTIFIER}.watchkitapp.watchkitextension", type: type, force_for_new_devices: newDevices)
end

def download_certificates_and_profiles(newDevices = false)
  ["development", "adhoc", "appstore"].each do |type|
    download_certificate_and_profile(type, newDevices)
  end
end

def bump_build_version
  build_number = number_of_commits
  increment_build_number(build_number: build_number)
end

def build_app(scheme, certificate_type)

  inform_team("Downloading Certificate And Provisoning Profile")
  download_certificate_and_profile(certificate_type)

  setup_project

  inform_team("Bumping Build Version")
  bump_build_version

  inform_team("Building App")
  gym(
    scheme: scheme,
    use_legacy_build_api: true
  )
end

def build_app_for_beta_testing(scheme, certificate_type)
  # Disabled until we can find a way to control where the changelog begins from
  # since it exceeds the lengthe crashyltics likes.
  # changelog_from_git_commits

  badge
  build_app(scheme, certificate_type)
end

def push_to_crashlytics(list)
  inform_team("Pushing to crashlytics")
  crashlytics(
    crashlytics_path: CRASHLYTICS_PATH,
    api_token: CRASHLYTICS_API_KEY,
    build_secret: CRASHLYTICS_BUILD_SECRET,
    ipa_path: IPA_PATH,
    groups: list
  )
  inform_team("Uploaded Build to Crashlytics")
end

def test_app
  setup_project
  scan(
    scheme: "Sup-Debug"
  )
end

####### Lanes #######

default_platform :ios

platform :ios do
  before_all do
    ensure_git_status_clean
    setup_enviroment_variables
  end

  desc "Runs all the tests"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Build and run the unit tests for the app."
  lane :test do
    test_app
  end

  desc "This is ran for the CI system, this is an alias for the `test` lane."
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Build and run the unit tests for the app."
  lane :pr do
    test_app
  end

  desc "Generates a new Xcode Project"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Install the Fix Code Xcode Plugin."
  lane :xcode do
    setup_project
    download_certificates_and_profiles
    install_fix_code_xcode_plugin
  end

  desc "Build and upload a new nightly build to Crashlytics"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Add a badge to the app icon"
  desc "- Generate a changelog from the git commits"
  desc "- Build, sign and upload the app"
  desc "- Send an email to all nightly testers."
  lane :nightly do
    inform_team("Pushing Nightly")
    build_app_for_beta_testing("Sup-Staging", "adhoc")
    push_to_crashlytics("sup-nightly")
  end

  desc "Build and upload a new beta build to Crashlytics"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Add a badge to the app icon"
  desc "- Generate a changelog from the git commits"
  desc "- Build, sign and upload the app"
  desc "- Send an email to all internal testers."
  lane :internal_beta do
    inform_team("Pushing Internal Beta")
    build_app_for_beta_testing("Sup-Release", "appstore")
    push_to_crashlytics("sup")
  end

  desc "Build and upload a new build to Apple TestFlight"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Add a badge to the app icon"
  desc "- Generate a changelog from the git commits"
  desc "- Build, sign and upload the app"
  desc "- This will **not** send an email to all testers, it will only be uploaded to the new TestFlight."
  lane :external_beta do
    inform_team("Pushing External Beta")
    build_app_for_beta_testing("Sup-Release", "appstore")
    pilot
  end

  desc "Submit a new version to the App Store"
  desc "This will do the following: "
  desc "- Generate the Xcode Project based on the Cakefile"
  desc "- Install CocoaPods"
  desc "- Make sure the profiles are up to date and download the latest one"
  desc "- Do a build version bump and push it"
  desc "- Collect the app metadata from `./fastlane/metadata`"
  desc "- Upload screenshots + app metadata"
  desc "- Build, sign and upload the app"
  desc "- Upload dSYM files to Crashlytics"
  desc "This will **not** submit the app for review."
  lane :deploy do
    inform_team("Deploying To App Store")
    build_app("Sup-Release", "appstore")

    inform_team("Uploading to iTunes Connect")
    deliver
    inform_team("Uploaded Build #{Actions.lane_context[SharedValues::BUILD_NUMBER]} to iTunes Connect")

    inform_team("Uploading dSYMs to Crashlytics")
    upload_symbols_to_crashlytics
  end

  desc "Updates the dsyms uploaded to crashlytics from iTunes Connect"
  desc "This will do the following: "
  desc "- Download all dSYM files from iTunes Connect"
  desc "- Upload them to Crashlytics"
  desc "- Delete the local dSYM files"
  lane :refresh_dsyms do
     download_dsyms                  # Download dSYM files from iTunes Connect
     upload_symbols_to_crashlytics   # Upload them to Crashlytics
     clean_build_artifacts           # Delete the local dSYM files
  end

  desc "Make sure the profiles are up to date and download the latest one when we add new devices"
  lane :regenerate_for_new_devices do
    download_certificates_and_profiles(true)
  end

  # You can define as many lanes as you want

  after_all do |lane|

    reset_git_repo

    return unless Helper.is_ci?

    slack(
      message: "Successfully built #{lane}"
    )
  end

  error do |lane, exception|
    return unless Helper.is_ci?

    slack(
      message: exception.message,
      success: false
    )
  end
end

# More information about multiple platforms in fastlane: https://github.com/KrauseFx/fastlane/blob/master/docs/Platforms.md
# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md

Environment

fastlane version (run fastlane -v): 1.87.0

Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? no

Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? rvm

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Ah seems to be bug in a tool I’m using, the behaviour is fine 😃 in the future I may be building a linter which would guard against these issues.

closing for now.