fastlane: Resign error, when using match xcode 8

New Issue Checklist

Issue Description

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

You can use: --capture_output as the last commandline argument to get that collected for you

[16:36:10]: Successfully exported and compressed dSYM file [16:36:10]: Successfully exported and signed the ipa file: [16:36:10]: /SourceTree/demo/demo.ipa [16:36:10]: -------------------------- [16:36:10]: — Step: notification — [16:36:10]: -------------------------- [16:36:11]: ----------------- [16:36:11]: — Step: act — [16:36:11]: ----------------- [16:36:11]: Patching Plist: GoogleService-Info.plist [16:36:11]: -------------------- [16:36:11]: — Step: resign — [16:36:11]: -------------------- /usr/local/lib/ruby/gems/2.3.0/gems/sigh-1.11.2/lib/assets/resign.sh ./Siesta.ipa 4D7F77EF86DEAE5C508D9D8206FF4D4BB3C3A84F -p dk.demo.demo=/SourceTree/certificates/profiles/appstore/AppStore_dk.demo.demo.mobileprovision ./Siesta.ipa security: failed to add data to decoder: UNKNOWN (-8183(d) security: problem decoding Print: Entry, “:Entitlements:application-identifier”, Does Not Exist security: failed to add data to decoder: UNKNOWN (-8183(d) security: problem decoding Print: Entry, “:Entitlements:application-identifier”, Does Not Exist security: failed to add data to decoder: UNKNOWN (-8183(d) security: problem decoding Encountered an error, aborting!

[16:36:13]: Something went wrong while code signing ./Siesta.ipa [16:36:13]: -------------------------- [16:36:13]: — Step: notification — [16:36:13]: -------------------------- [16:36:13]: Variable Dump: [16:36:13]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>“ios release”, :SIGH_PROFILE_TYPE=>“app-store”, :IPA_OUTPUT_PATH=>“/SourceTree/demo/demo.ipa”, :DSYM_OUTPUT_PATH=>“/SourceTree/Siesta-iOS/demo.app.dSYM.zip”, :XCODEBUILD_ARCHIVE=>“Library/Developer/Xcode/Archives/2016-11-08/Siesta 2016-11-08 16.30.55.xcarchive”} [16:36:13]: Failed to re-sign .ipa

±-----±------------------------------------±------------+ | fastlane summary | ±-----±------------------------------------±------------+ | Step | Action | Time (in s) | ±-----±------------------------------------±------------+ | 1 | Verifying required fastlane version | 0 | | 2 | default_platform | 0 | | 3 | clear_derived_data | 0 | | 4 | notification | 0 | | 5 | match | 10 | | 6 | notification | 0 | | 7 | gym | 317 | | 8 | notification | 0 | | 9 | act | 0 | | 💥 | resign | 2 | | 11 | notification | 0 | ±-----±------------------------------------±------------+

[16:36:13]: fastlane finished with errors

[!] Failed to re-sign .ipa

Environment

Please run fastlane env and copy the output below. This will help us help you 👍 If you used --capture_output option please remove this block - as it is already included there.

✅ fastlane environment ✅

Stack

Key Value
OS 10.12.1
Ruby 2.3.1
Bundler? false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.1
Git git version 2.9.3 (Apple Git-75)
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.12.1 (16B2555)
Ruby Lib Dir /usr/local/Cellar/ruby/2.3.1_2/lib
OpenSSL Version OpenSSL 1.0.2j 26 Sep 2016

fastlane files:

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

require 'fileutils'

# update_fastlane
fastlane_version "1.92.0"
default_platform :ios


#PLATFORM 'LANES' FOR IOS DEPLOYEMENT
platform :ios do

  before_all do

    clear_derived_data

    #DOWNLOAD THE NEEDED FILES: DefaultIcon.png, Client.json, Client_metadata.json

    #plugin to be used: 'delete_files' -> Deletes a file, folder or multiple files using HTTP/HTTPS

    #MOVE THE DOWNLOADED CLIENT.JSON file into the Config folder
    FileUtils.cp(ENV["CLIENT_INFORMATION_DIR"]+'client.json', ENV["SIESTA_IOS_DIR"]+'Siesta/Config/client.json')
    puts "DONE MOVING THE CLIENT.JSON FILE ✅"

    #Make sure that we have all the pods installed
    #cocoapods

  end

#TEST LANE - SCANNING THE CODE AND RUNNING IN SIMULATOR
  desc "Runs all the tests"
  lane :test do
    scan(
      scheme: "Siesta",
      device: "iPhone 6",
      clean: true)
  end

###########################################################################################
## ----------------------- RELEASE APP TO THE APPSTORE --------------------------------- ##
###########################################################################################

## HOW TO GUIDE ->
## -------------------- CREATE NEW APP: fastlane release new:true ---------------------- ##
## ----------------- UPDATE EXISTING APP: fastlane release new:false ------------------- ##

    desc "Updates and deploy a new version to the App Store"
    lane :release do |options|

  #LET PEOPLE KNOW WE ARE STARTING FASTLANE
      #inform_team("Fastlane started for: 🏼" + ENV["META_APP_FULL_NAME"] + " (" + ENV["APP_IDENTIFIER"] + ") 🙌", true)

  #CREATE APP ICON FROM 1024 x 1024 IMAGE - https://github.com/KrauseFx/fastlane-plugin-appicon
      #appicon(
      #  appicon_image_file: ENV["CLIENT_INFORMATION_DIR"] + "DefaultIcon.png",
      #  appicon_devices: [:ipad, :iphone],
      #  appicon_path: ENV["SIESTA_IOS_DIR"] + 'Siesta/Assets.xcassets'
      #)
      #notification(subtitle: "App icons ✅", message: "Created app icons")

  #GENERATE NEW SCREENSHOTS FOR THE APPSTORE
      #snapshot
      notification(subtitle: "Screenshots ✅", message: "Created screenshots")

      if options[:new] # Only when new is true
        #CREATE THE APP INSIDE ITUNESCONNECT
            produce(
              username: ENV["APPLE_ID"],
              team_id: ENV["TEAM_ID"],
              app_identifier: ENV["APP_IDENTIFIER"],
              app_name: ENV["META_APP_FULL_NAME"],
              language: 'English',
              version: build_version,
              sku: ENV["APP_IDENTIFIER"]
            )
            notification(subtitle: "App created in iTunes Connect ✅", message: "")
      end

  #CHECKS FOR CERTIFICATES+PROVISIONING PROFILES, AND CREATE NEW ONES IF NEEDED
      match(
          type: "appstore",
          app_identifier: ENV["APP_IDENTIFIER"]
      )
      notification(subtitle: "Match certificates done ✅", message: "Checked/Created distribution certificates for app")

      gym(
        scheme: "Siesta",
        configuration: "Release",
        clean: true,
        use_legacy_build_api: true,
        toolchain: :swift_2_3,
        xcargs: "PROVISIONING_PROFILE_SPECIFIER='match AppStore dk.napp.siestademonstration'"
      )
      notification(subtitle: "IPA file ✅", message: ".ipa file created in the gym 🏋🏼")

  # Modify the GoogleService-Info.plist inside the .ipa file
      act(
        ipa: "./Siesta.ipa",
        plist_file: "GoogleService-Info.plist",
        plist_values: {
          ":BUNDLE_ID" => ENV["APP_IDENTIFIER"],
          ":TRACKING_ID" => ENV["APP_TRACKING_ID"],
          ":PROJECT_ID" => ENV["APP_PROJECT_ID"],
          ":GOOGLE_APP_ID" => ENV["APP_GOOGLE_APP_ID"]
        }
      )

  #RE-SIGN THE APPLICATION (Because we have changed the plist file)
      resign(ipa: './Siesta.ipa',
              signing_identity: 'iPhone Distribution: Napp CMS ApS (CU486KS5XR)',
              provisioning_profile: {
                      ENV["APP_IDENTIFIER"] => '/Users/Jakob/SourceTree/certificates/profiles/appstore/AppStore_dk.napp.siestademonstration.mobileprovision'
              }
      )

  #CHECKS AND CREATES NEW PUSH CERTIFICATIONS IF NEEDED - IT CAN THEN BE UPLOADED TO aeroGearServer
      pem(
        force: options[:new], #check if the passed command contains new:true or new:false. App is new = force!
        app_identifier: ENV["APP_IDENTIFIER"],
        p12_password: ENV["PUSH_CERTIFICATE_PASSWORD"],
        output_path: ENV["CLIENT_INFORMATION_DIR"],
        new_profile: Proc.new do |profile_path|
              # Code to upload PEM file to aeroGearServer
              #puts profile_path # the absolute path to the new PEM file
        end
      )
      notification(subtitle: "Push certificates ✅", message: "Push certificates uploaded to AeroGear push server")

  #UPLOAD THE APP TO ITUNES CONNECT
      deliver(force: false)

  #INCREASE THE BUILD NUMBER
      increment_build_number
  #UPLOAD DSYM TO BUGSNAG - https://github.com/bugsnag/bugsnag-upload

    end

  # You can define as many lanes as you want

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    #Delete the .ipa / dSYM files when we are done.
    File.delete(ENV["SIESTA_IOS_DIR"]+"Siesta.ipa")
    File.delete(ENV["SIESTA_IOS_DIR"] + "Siesta.app.dSYM.zip")

    inform_team("Updated app: 🏼" + ENV["META_APP_FULL_NAME"] + " (" + ENV["APP_IDENTIFIER"] + ") 🙌", true)

    #POST SUCCESFULL MESSAGE TO SLACK - This need to be wrapped, to make sure if
    notification(subtitle: "Fastlane finished ✅", message: "We are done for now! 😎😎😎")

  end

  error do |lane, exception|
    notification(subtitle: "Fastlane error ❌", message: "...")

    #inform_team(exception.message, false)

  end

end


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

def inform_team(message, success)
  return if Helper.is_ci?

  slack(
    slack_url: ENV["SLACK_URL"],
    channel: ENV["SLACK_CHANNEL"],
    success: true,
    default_payloads: [],
    message: message
  )

end

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

# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
`./fastlane/Appfile`
require 'open-uri'

# GET ENV VARIABLES FOR ACCOUNT / GENERAL USE
env_file = "/Users/Jakob/SourceTree/Siesta-iOS/env.json"
envObj = JSON.parse(open(env_file).read)

#SET THE ENVIRONMENT VARIABLES
ENV["APPLE_ID"] = envObj["apple_id"]
ENV["ITC_TEAM_ID"] = envObj["itc_team_id"]
ENV["TEAM_ID"] = envObj["team_id"]

ENV["PUSH_CERTIFICATE_PASSWORD"] = envObj["p12_password"]

ENV["SLACK_URL"] = envObj["slack_url"]
ENV["SLACK_CHANNEL"] = envObj["slack_channel"]

#FOLDERS
ENV["CLIENT_INFORMATION_DIR"] = "/Users/Jakob/SourceTree/Siesta-iOS/client_information/"
ENV["SIESTA_IOS_DIR"] = "/Users/Jakob/SourceTree/Siesta-iOS/"

# GET ENV VARIABLES FOR APP - SPECIFIC USE FOR INDIVIDUAL APP

#CODE READY FOR BACKEND TO PASS ON THE JSON FILES
#app = JSON.parse(open("http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo").read)


url = ENV["CLIENT_INFORMATION_DIR"] + "client.json"
app = JSON.parse(open(url).read)

ENV["APP_TRACKING_ID"] = app["moduleStatisticsTrackerCode"]
ENV["APP_CLIENT_NAME"] = app["clientName"]
ENV["APP_GOOGLE_APP_ID"] = app["google_app_id"]
ENV["APP_IDENTIFIER"] = app["namespace"]
ENV["APP_PROJECT_ID"] = app["project_id"]

url = ENV["CLIENT_INFORMATION_DIR"] + "Client_metadata.json"
meta_app = JSON.parse(open(url).read)

ENV["META_APP_FULL_NAME"] = meta_app["fullName"]

##SET THE OVERALL STUFF
apple_id ENV["APPLE_ID"]
itc_team_id ENV["ITC_TEAM_ID"]
team_id ENV["TEAM_ID"]

#puts "DONE READING THE CLIENT.JSON + CLIENT_METADATA FILES ✅"

#SET THE FASTLANE VARIABLES
#apple_id ENV["APPLE_ID"] # Your Apple email address
#itc_team_id ENV["ITC_TEAM_ID"] #The ID of your iTunes Connect team if you're in multiple teams
#team_id ENV["TEAM_ID"] #The ID of your Developer Portal team if you're in multiple teams

#app_identifier app["identifier"]
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

fastlane gems

Gem Version Update-Status
credentials_manager 0.16.2 ✅ Up-To-Date
fastlane_core 0.53.0 ✅ Up-To-Date
spaceship 0.37.0 ✅ Up-To-Date
deliver 1.15.0 ✅ Up-To-Date
snapshot 1.16.3 ✅ Up-To-Date
frameit 3.0.0 ✅ Up-To-Date
pem 1.4.0 ✅ Up-To-Date
cert 1.4.3 ✅ Up-To-Date
sigh 1.11.2 ✅ Up-To-Date
produce 1.3.0 ✅ Up-To-Date
gym 1.12.0 ✅ Up-To-Date
pilot 1.12.0 ✅ Up-To-Date
scan 0.14.1 ✅ Up-To-Date
supply 0.7.1 ✅ Up-To-Date
match 0.10.0 ✅ Up-To-Date
screengrab 0.5.5 ✅ Up-To-Date
fastlane 1.107.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-appicon 0.4.0 ✅ Up-To-Date
fastlane-plugin-act 1.0.1 ✅ Up-To-Date
fastlane-plugin-update_project_codesigning 0.1.2 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.0.2
highline 1.7.8
commander 4.4.0
terminal-table 1.4.5
json 1.8.3
multipart-post 2.0.0
faraday 0.9.2
faraday_middleware 0.10.0
dotenv 2.1.1
net-ssh 3.2.0
net-sftp 2.1.2
plist 3.1.0
security 0.1.3
krausefx-shenzhen 0.14.10
slack-notifier 1.5.1
rouge 1.11.1
xcpretty 0.2.4
terminal-notifier 1.7.1
addressable 2.4.0
claide 1.0.1
xcode-install 2.0.8
word_wrap 1.0.0
multi_json 1.12.1
colored 1.2
babosa 1.0.2
excon 0.54.0
rubyzip 1.1.7
gh_inspector 1.0.2
credentials_manager 0.16.2
fastlane_core 0.53.0
bundler 1.13.6
multi_xml 0.5.5
unf_ext 0.0.7.2
unf 0.1.4
domain_name 0.5.20161021
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
fastimage 1.6.8
mini_magick 4.5.1
xcpretty-travis-formatter 0.0.4
uber 0.0.15
representable 2.3.0
retriable 2.1.0
mime-types-data 3.2016.0521
mime-types 3.1
hurley 0.2
little-plugger 1.1.4
logging 2.1.0
jwt 1.5.6
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.2.4
google-api-client 0.9.19
i18n 0.7.0
thread_safe 0.3.5
tzinfo 1.2.2
activesupport 4.2.7.1
io-console 0.4.6
CFPropertyList 2.3.3
nanaimo 0.2.1
xcodeproj 1.4.1
fastlane-plugin-appicon 0.4.0
fastlane-plugin-act 1.0.1
fastlane-plugin-update_project_codesigning 0.1.2

generated on: 2016-11-08

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18

Most upvoted comments

The match_decrypt(path: "/where/to/put/decrypted_git_stuff"); looks interesting! 🏂

I’ve ran into the following error when i’m resigning the app with the provisioning profile, which i just decrypted. Seems like it does not code sign the cocoa pods we are using?

 [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Siesta' must be signed with the certificate that is contained in the provisioning profile."
[22:44:25]: [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Frameworks/AeroGearPush.framework/AeroGearPush' must be signed with the certificate that is contained in the provisioning profile."
[22:44:25]: [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Frameworks/Alamofire.framework/Alamofire' must be signed with the certificate that is contained in the provisioning profile."
[22:44:25]: [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Frameworks/AlamofireObjectMapper.framework/AlamofireObjectMapper' must be signed with the certificate that is contained in the provisioning profile."
[22:44:25]: [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Frameworks/Bugsnag.framework/Bugsnag' must be signed with the certificate that is contained in the provisioning profile."
[22:44:25]: [Transporter Error Output]: ERROR ITMS-90179: "Invalid Code Signing. The executable 'Payload/Siesta.app/Frameworks/DGActivityIndicatorView.framework/DGActivityIndicatorView' must be signed with the certificate that is contained in the provisioning profile."

Hi again, this seems to fix the issue, by using the solution 2

Would it be possible in future releases of fastlane to add a the resign feature to be using the match provisioning profile, where it automatically decrypts it?

Thanks, i’ll look into it tomorrow morning (Copenhagen time) and let you know. Thanks!

ok - i got you

i think you can do it with one of the following scenarios:

Scenario 1

decrypt the mobile provision manually with (requires you to have the encrypted file somwhere):

openssl aes-256-cbc -k MATCH_PASSWORD -in /path/to/crypted/file.mobileprovision -out /path/where/decrypted/file/will/end.mobileprovision -a -d 

you should end up with an decrypted file in

/path/where/decrypted/file/will/end.mobileprovision

Scenario 2

  • run match to generate validate and all the stuff.
  • later on use the profile_name env , and use spaceship to download the prov.prof from apple
  • 👊 boom you got a decrypted profile 😃 - in raw.mobileprovision

be sure to change:

  • hjanuschka.sticker-test to your bundle id
  • sigh_hjanuschka.sticker-test_development_profile-name to your sigh env. - gets printed during match.
lane :demo do
  match(
        git_url: "git@gxxx.at:mobile/IOS-CERTIFICATES.git",
        app_identifier: "hjanuschka.sticker-test"
  )
  Spaceship::Tunes.login

  all_profiles = Spaceship::Portal.provisioning_profile.all
  profile  = all_profiles.find_all { |p| p.name == ENV["sigh_hjanuschka.sticker-test_development_profile-name"] }
  File.open("raw.mobileprovision", "wb") do |f|
       f.write(profile.first.download)
  end
end

hope this helps you!

i am not sure if there is a easier way to get the profile decrypted - and still managed by match

edit: if you mean my last comment with the PlistBuddy - no you just have to supply a decrypted prov. prof. to the resign action.