xcodecontinuous-integrationxcode-bots

Xcode Bots do not update git submodules to specified commit


My Xcode Bot is using an outdated version of my repo's submodules.

It builds old submodule code despite the submodule being updated to a new version in the commit history of the parent app.

  1. Parent repo uses submodule v1.0.
  2. Parent repo updates submodule to v2.0 and commits subproject commit to github.
  3. The "on commit" Xcode Bot is run for the new commit automatically.
  4. Parent app is uploaded to TestFlight.
  5. TestFlight build contains the correct v2.0 submodule commit (the last commit to parent repo).
  6. However the TestFlight build contains the outdated submodule v1.0 code.

I thought I was going crazy when my bugs were reproducible on the TestFlight build despite being "fixed" in the submodule and local builds.

It turns out Xcode Bots do not properly pull the specified submodule commit.


Solution

  • As of Xcode 6, Xcode Bots are not guaranteed to update the repo's submodules to the specified commit.

    You will need to manually update the submodules prior to the Xcode Bot's build:

    git submodule update --init --recursive
    

    To make this easier I've added updateGitSubmodules to the cavejohnson Xcode Bot scripting tool. Add the following to your Before Integration Run Script phase to update submodules automatically:

    Before Integration > Run Script:

    #!/bin/bash
    PATH=/Library/Frameworks/Python.framework/Versions/3.4/bin:$PATH
    
    cavejohnson updateGitSubmodules
    

    Finally, we've opened an ticket to explore how this behavior can be fixed upstream.