xorpaul/g10k

syncing multiple git sources with same branches fails

juliantaylor opened this issue · 1 comments

syncing multiple git sources with the same branch does not work anymore probably since strip_components was added:

sources:
  hiera:
    remote: 'gitb' 
    basedir: '/opt/puppetlabs/code/g10kstaging/hiera'
  filestore:
    remote: 'gita' 
    basedir: '/opt/puppetlabs/code/g10kstaging/filestore/'

gita and gitb contain the same branches and no puppetfile.

This then fails despite no renaming happening at all:

g10k -config config.yaml -info
Renamed environment naming conflict detected with renamed environment master

this used to work fine in version 0.8.9

Yeah, the implementation to save all Puppet environments in a helper struct was pretty naive:

if _, ok := allEnvironments[prefix+renamedBranch]; !ok {
  allEnvironments[prefix+renamedBranch] = true
} else {
  Fatalf("Renamed environment naming conflict detected with renamed environment " + prefix + renamedBranch)
}

This does not work with same branch names when someone isn't using a prefix for their environments, but different basedir settings

I've adjusted this to the absolute filepath of the environment:

if _, ok := allEnvironments[filepath.Join(sa.Basedir, prefix+renamedBranch)]; !ok {
  allEnvironments[filepath.Join(sa.Basedir, prefix+renamedBranch)] = true
} else {
  Fatalf("Renamed environment naming conflict detected with renamed environment " + prefix + renamedBranch)
}

Should be fixed with #222
I'm in the process of releasing a new version.