Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 + Bots + Fastlane: How to automatically deploy an app to itunes connect using Fastlane's Deliver

Question: How can I upload an IPA to itunesconnect from a Bot running on Xcode 7 and Server 4.1 using Deliver?

I've been able to set up a continuous integration solution in with Xcode 6.4, Server 4.1 using bots, and Deliver (by fastlane). Once I upgraded to Xcode 7 beta-3, my Bots stopped working.

Here is a brief outline of what I did for Xcode 6.4:

  1. Select "Perform Archive Action" in Bot Setting
  2. From post trigger: echo gem install --user-install deliver #Run To Install Gem
  3. From post trigger: echo export PATH=$PATH:/var/_xcsbuildd/.gem/ruby/2.0.0/bin #Run to Add Gems to Path
  4. From post trigger:

    echo `DELIVER_PASSWORD="Password"
    /var/_xcsbuildd/.gem/ruby/2.0.0/bin/deliver testflight 
    "${IPA_PATH}" -a 101233338 -u [email protected] --beta`
    

Everything worked great and a build was uploaded to itunesconnect after every integration.

When I upgraded to Xcode 7, I was no longer able to upload to itunesconnect with Deliver. Here is my Xcode 7 workflow:

  1. Tests Pass
  2. Archive successful
  3. Post trigger 1: Build IPA Successfully (Using recommendation from this apple developer post)

     xcrun xcodebuild -exportArchive -archivePath 
     $XCS_ARCHIVE -exportPath $XCS_ARCHIVE
     -exportOptionsPlist /Library/Developer/XcodeServer/ExportOptions.plist 
     -IDEPostProgressNotifications=YES 
     -DVTAllowServerCertificates=YES 
     -DVTSigningCertificateSourceLogLevel=3 
     -DVTSigningCertificateManagerLogLevel=3 
     -DTDKProvisioningProfileExtraSearchPaths=/Library/Developer/XcodeServer/ProvisioningProfiles
    
  4. Attempt to upload IPA with Deliver:

    echo `DELIVER_PASSWORD="Password"
    /var/_xcsbuildd/.gem/ruby/2.0.0/bin/deliver testflight 
    "${IPA_PATH}" -a 101233338 -u [email protected] --beta`
    

Result: Build Service Issues: Terminated xcodebuild since it produced no output for too long. enter image description here Note: I am able to take the IPA's produced by the bot and upload them via the terminal.

Update

Xcode wasn't printing out all the logs, when I redirected the output into a file it looks like Deliver ran just fine

ESC[37m[12:03:08]: ESC[0mESC[32mReady to upload new build to TestFlight (CiTest - 1018099468)ESC[0m
ESC[37m[12:03:08]: ESC[0mUploading ipa file to iTunesConnect
ESC[37m[12:03:08]: ESC[0mGoing to upload updated app to iTunesConnect
ESC[37m[12:03:08]: ESC[0mESC[32mThis might take a few minutes, please don't interrupt the scriptESC[0m
ESC[37m[12:03:08]: ESC[0mESC[32mWaiting for iTunes Connect transporter to be finished.ESC[0m
ESC[37m[12:03:08]: ESC[0mESC[32miTunes Transporter progress... this might take a few minutes...ESC[0m

It's just that the xcode server escapes the process before deliver completes.

Follow-up: Has anyone else experienced this or a similar issue?

like image 237
Theodore Haden Avatar asked Jul 13 '15 07:07

Theodore Haden


1 Answers

I found this thread from apple developer forum: https://forums.developer.apple.com/thread/9812

In case you couldn't open it. Some people said

It seems that Xcode bot trigger scripts have a 10 second timeout - which is far too short to do any useful work. I can replicate this by adding a "Before Integration" trigger containing nothing but a call to "sleep 10". When the integration runs, it fails with the error "terminated xcodebuild since it produced no output for too long".

And possible temp solution could be

make sure you produce some output when your longer running task is running? Not a fix, but might be a workaround.

And people replied

I have done this and the error no longer occurs. I was using a bash script and needed to echo the output from time to time to workaround this issue.

Hopefully this will help for the moment.

like image 139
Jackie Avatar answered Nov 07 '22 21:11

Jackie