Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-15939

Merging branches do not work correctly with submodules

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Low
    • None
    • 5.7.2, 5.9.10
    • None
    • None

    Description

      Summary

      Branch builds do not update submodules correctly. On a plan for a master build, I have a dmz branch configured as a Gatekeeper, merging back to master (screenshot attached). Every so often the commit pushed to master will not include a submodule update. Investigating the logs, I can see that submodules are updated after checking out the master branch, but not after merging dmz, resulting in the wrong thing being pushed to master (checkout log pasted below).

      We have an explicit submodule update task in our build, which must be working some of the time, since sometimes the submodule does get updated on master, and sometimes it does not.

      simple	07-May-2015 15:02:14	Build rrCore - core - CI - master - dmz - Maven Build #1665 (RRCORE-MTEST0-JOB1-1665) started building on agent Local Agent #2
      simple	07-May-2015 15:02:14	Build working directory is /home/rrbuild/atlassian/bamboo/xml-data/build-dir/2654209/RRCORE-MTEST0-JOB1
      simple	07-May-2015 15:02:14	Executing build rrCore - core - CI - master - dmz - Maven Build #1665 (RRCORE-MTEST0-JOB1-1665)
      simple	07-May-2015 15:02:14	Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
      simple	07-May-2015 15:02:14	Build always requires a clean checkout
      simple	07-May-2015 15:02:14	Cleaning build directory '/home/rrbuild/atlassian/bamboo/xml-data/build-dir/2654209/RRCORE-MTEST0-JOB1'
      simple	07-May-2015 15:02:19	Checking out code from RRCORE-MTEST, revision d689a2a368ab09c20e4e54a7ca28c92ea1034de2
      simple	07-May-2015 15:02:19	/usr/bin/git log -1 --encoding=UTF-8 --format=%H HEAD
      simple	07-May-2015 15:02:19	Fetching 'refs/heads/master' from 'https://git.richrelevance.com/scm/rr/core.git'.
      simple	07-May-2015 15:02:19	/usr/bin/git fetch https://rrBuild:********@git.richrelevance.com/scm/rr/core.git +refs/heads/master:refs/heads/master --update-head-ok --progress --verbose
      simple	07-May-2015 15:02:19	From https://git.richrelevance.com/scm/rr/core
      simple	07-May-2015 15:02:19	 = [up to date]      master     -> master
      simple	07-May-2015 15:02:19	/usr/bin/git log -1 --encoding=UTF-8 --format=%H d689a2a368ab09c20e4e54a7ca28c92ea1034de2
      simple	07-May-2015 15:02:19	Checking out revision d689a2a368ab09c20e4e54a7ca28c92ea1034de2.
      simple	07-May-2015 15:02:19	Creating local git repository in '/home/rrbuild/atlassian/bamboo/xml-data/build-dir/2654209/RRCORE-MTEST0-JOB1/.git'.
      simple	07-May-2015 15:02:19	/usr/bin/git clone file:///home/rrbuild/atlassian/bamboo/xml-data/build-dir/_git-repositories-cache/8433d4450d298235aada0aca7c7ff1f7065aaf15 -n --reference /home/rrbuild/atlassian/bamboo/xml-data/build-dir/_git-repositories-cache/8433d4450d298235aada0aca7c7ff1f7065aaf15 /home/rrbuild/atlassian/bamboo/xml-data/build-dir/2654209/RRCORE-MTEST0-JOB1
      simple	07-May-2015 15:02:19	Cloning into '/home/rrbuild/atlassian/bamboo/xml-data/build-dir/2654209/RRCORE-MTEST0-JOB1'...
      simple	07-May-2015 15:02:20	/usr/bin/git show-ref master
      simple	07-May-2015 15:02:20	/usr/bin/git checkout -f master
      simple	07-May-2015 15:02:23	Already on 'master'
      simple	07-May-2015 15:02:23	/usr/bin/git remote set-url origin https://rrBuild:********@git.richrelevance.com/scm/rr/core.git
      simple	07-May-2015 15:02:23	/usr/bin/git submodule update --init --recursive
      simple	07-May-2015 15:02:23	Submodule 'rrDatamesh/rrDatameshPortal/src/main/resources/webapp/jsp' (https://git.richrelevance.com/scm/rr/dashboard-dynamic.git) registered for path 'rrDatamesh/rrDatameshPortal/src/main/resources/webapp/jsp'
      simple	07-May-2015 15:02:23	Submodule 'rrOC/oc-ui/src/main/resources/webapp/jsp' (https://git.richrelevance.com/scm/rr/dashboard-dynamic.git) registered for path 'rrOC/oc-ui/src/main/resources/webapp/jsp'
      simple	07-May-2015 15:02:23	Submodule 'rrPortal/src/main/resources/webapp/jsp' (https://git.richrelevance.com/scm/rr/dashboard-dynamic.git) registered for path 'rrPortal/src/main/resources/webapp/jsp'
      simple	07-May-2015 15:02:24	Cloning into 'rrDatamesh/rrDatameshPortal/src/main/resources/webapp/jsp'...
      simple	07-May-2015 15:02:24	Submodule path 'rrDatamesh/rrDatameshPortal/src/main/resources/webapp/jsp': checked out '2ea6485c632232e3dd4e6601e7ce15ea381ce13b'
      simple	07-May-2015 15:02:24	Cloning into 'rrOC/oc-ui/src/main/resources/webapp/jsp'...
      simple	07-May-2015 15:02:25	Submodule path 'rrOC/oc-ui/src/main/resources/webapp/jsp': checked out '2ea6485c632232e3dd4e6601e7ce15ea381ce13b'
      simple	07-May-2015 15:02:25	Cloning into 'rrPortal/src/main/resources/webapp/jsp'...
      simple	07-May-2015 15:02:25	Submodule path 'rrPortal/src/main/resources/webapp/jsp': checked out '2ea6485c632232e3dd4e6601e7ce15ea381ce13b'
      simple	07-May-2015 15:02:25	/usr/bin/git remote set-url origin file:///home/rrbuild/atlassian/bamboo/xml-data/build-dir/_git-repositories-cache/8433d4450d298235aada0aca7c7ff1f7065aaf15
      simple	07-May-2015 15:02:25	Merging code from RRCORE-MTEST0-JOB1, revision 5bfc0581534ae0a3c9d08fb3c857142c1585d71f
      simple	07-May-2015 15:02:27	Merged new changesets from RRCORE-MTEST0-JOB1
      simple	07-May-2015 15:02:27	Updated source code to revision: d689a2a368ab09c20e4e54a7ca28c92ea1034de2
      simple	07-May-2015 15:02:27	Finished task 'Checkout Default Repository' with result: Success
      
      

      Workaround

      For submodules defined with an absolute path:
      Add a script task to manually execute "git submodule update --init --recursive" as a build step.

      For submodules defined with a relative path, since it won't be present in the git cache we'll need to change the remote:
      Add a script task to manually execute the below as a build step.

      git remote set-url origin ${bamboo.planRepository.repositoryUrl}
      git submodule sync
      git submodule update --init --recursive
      git remote remove origin
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              82040a6c5d48 Daniel Sobral
              Votes:
              6 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: