Setup
For every site we make a custom Drupal install profile is created, copies of which are built using drush make
(through Aegir, though that should not make a difference).
There is a top-level build makefile for downloading Drupal core and our install profile, and the install profile contains a makefile specifying Features to download, each of which have a makefile specifying their dependencies (either custom modules in private git repos or contrib modules).
The build makefile (build-SITENAME.make
) specifies the install profile like this:
projects[SITENAME_profile][type] = profile
projects[SITENAME_profile][download][type] = git
projects[SITENAME_profile][download][url] = git.hostname:drupal-sites/SITENAME_profile
Then the install profile's makefile will specify a bunch of Features to download, for example:
projects[blog][type] = module
projects[blog][subdir] = features
projects[blog][download][type] = git
projects[blog][download][url] = git.hostname:drupal-features/blog
Which will then download custom and contrib modules and so on.
The above setup has worked well for a couple of years.
Problem
The problem occurs when trying to use git branches for managing different stages of development, e.g. development, staging and production; and having CI automatically manage Drupal sites for each branch. If a build is triggered for the development branch, drush make
has to get the correct branch for every one of our repos it downloads.
Given our multi-repo and recursive makefile structure, how would drush make
be used to recursively download the correct branch from our git repos?
Things already tried
drush make
allows downloading from a git branch, which seemed good for our use-case. For example, for each makefile (in the build, install profile and Features repositories) a line is added that looks like:projects[blog][download][branch] = development
When the branch of the repo being downloaded matches the branch of the repo the makefile is in, custom modules specified in the development branch of the 'blog' Feature will be downloaded from that module's development branch. Great!
However, this causes problems merging the branches of any repo containing a makefile (given our setup that's quite a lot), we will have to be extremely careful not to accidentally merge
[branch] = development
into master on any of them.- Checked
drush make
documentation for a command-line option to specify the default branch for git repository downloads. Found nothing. - Searched the Internet for people with similar quandaries, it seems many are dumping all the dependencies for whole projects into single make files, but that breaks the modularity of Features.
Note: I'm not polling or asking for discussion. I believe there's something silly I'm missing and/or something everyone else is doing that I'm not.