Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Does Bamboo support Git submodules

D K January 19, 2015

I have a git repo that pulls in a number of other repos as submodules??

  • I want to Bamboo Plan to pull in the submodules and checkout a specific branch in each submodule
  • I also want Bamboo Plan trigger a build if a commit was made to one of the submodules.

 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Richard Cross February 12, 2015

No, this is not supported.  Bamboo has very limited support of git submodules, and they are as follows... Bamboo will check out submodule (you set this in the repository's "Advanced" section) on the very first build, but on subsequent pushes to the parent repo it will not update the submodules

The workaround is to run the submodule update manually in a Script Task like this:

git submodule foreach git pull origin master

EDIT #1:  Another workaround (and probably Atlassian's favoured model) is not to use submodules, but instead check out all relevant repos in your build into the directory structure you need.

EDIT #2: ... and this might be because use of Git submodules is frowned upon by some, see: http://bit.ly/1vGNJnv

Mike Ellertson July 1, 2018

boo, boo I say

Telling someone, "don't do that" is unacceptable, in my opinion.  Especially when it's supported by a simple command `git clone --recurse-submodules <url_to_git_repo>`

Like # people like this
Christian Leichsenring July 10, 2018

There was absolutely no need for the LMGTFY link though. Rude, and a waste of everybody's time.

Like # people like this
0 votes
Heather Mardis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 12, 2015

I have git repos that are setup to use submodules and I am running CI from a bamboo build plan (bamboo 5.6.1), it's running in a non-cleaning workspace so it's not doing a new clone for each build.

the steps I see in my 'sourcecode checkout task' are noted below but I believe the result is equivalent as the checkout is using 'git submodule update --init --recursive' to pull in the updated submodules and this is working unless I'm missing something. I have added a feature request to support 'git submodule update --remote' to support updating the submodules to HEAD. https://jira.atlassian.com/browse/BAM-15551

So from my perspective submodules are supported in both clone and update.

*** log snippet***

Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
Updating source code to revision: 35c4925c8a6796c10bf84b17e50de50550de23b6
/usr/local/bin/git version
/usr/local/bin/git log -1 --encoding=UTF-8 --format=%H HEAD
/usr/local/bin/git ls-remote ssh://myuser@server/data/gitroot/Ozone
Fetching 'refs/heads/master' from 'ssh://myuser@server/data/gitroot/Ozone'.
/usr/local/bin/git fetch ssh://myuser@server/data/gitroot/Ozone +refs/heads/master:refs/heads/master --update-head-ok --progress --verbose
Warning: Permanently added 'monster,192.168.129.160' (RSA) to the list of known hosts.
remote: Counting objects: 2, done.        
<snip>
= [up to date]      master     -> master
<snip>
/usr/local/bin/git log -1 --encoding=UTF-8 --format=%H 35c4925c8a6796c10bf84b17e50de50550de23b6
Checking out revision 35c4925c8a6796c10bf84b17e50de50550de23b6.
/usr/local/bin/git remote set-url origin file:///bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/5e7984b15d5072901c9dfbc79d45825664b29155
/usr/local/bin/git show-ref master
/usr/local/bin/git checkout -f 35c4925c8a6796c10bf84b17e50de50550de23b6
HEAD is now at 35c4925... REMOVE PLUGINCEPTION
/usr/local/bin/git remote set-url origin ssh://myuser@server/data/gitroot/Ozone
/usr/local/bin/git submodule update --init --recursive
/usr/local/bin/git remote set-url origin file:///bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/5e7984b15d5072901c9dfbc79d45825664b29155
Updated source code to revision: 35c4925c8a6796c10bf84b17e50de50550de23b6
Finished task 'Checkout Default Repository' with result: Success
Mike Ellertson July 1, 2018

I'm presently running Bamboo 6.2.2.  But, I can't find a way to do what you have descrbed as workong on your Bamboo 5.6.1 system.  Can you elaborate on how you made this work?

TAGS
AUG Leaders

Atlassian Community Events