Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncing multiple git sources with same branches fails #220

Closed
juliantaylor opened this issue Jan 22, 2024 · 1 comment
Closed

syncing multiple git sources with same branches fails #220

juliantaylor opened this issue Jan 22, 2024 · 1 comment
Assignees

Comments

@juliantaylor
Copy link
Contributor

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

@xorpaul
Copy link
Owner

xorpaul commented Jan 25, 2024

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.

@xorpaul xorpaul closed this as completed in fc83c96 Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants