xorpaul / g10k

my r10k fork in Go
Apache License 2.0
125 stars 50 forks source link

Add support for strip_component #202

Closed andni233 closed 1 year ago

andni233 commented 1 year ago

r10k supports a source configuration option strip_component: https://github.com/puppetlabs/r10k/blob/main/doc/dynamic-environments/configuration.mkd#strip_component

This adds similar support to g10k.

xorpaul commented 1 year ago

Wow, cool. Thanks for this, let me check if I can add a test for this feature before merging.

xorpaul commented 1 year ago

Closed in favor of #204

I had to reshuffle some things as we don't want to rename the Puppet environment at the end when we're untar the git repository as we have a section for this already here https://github.com/xorpaul/g10k/pull/204/files#diff-900e9873f6417c9eea63c4ed0761750bd4f836dca36020932d8414a1312076a3

We also don't want to check for the strip_component on every module based on a git repository.

While creating the dedicated tests for this feature, I came across the following bug: What happens when you have branches like

I already had a map with all renamed Puppet envs available, so checking for that was pretty easy, but the user still has to find out why such a conflict occurred as I don't print which feature was responsible for the renaming in the error output. This is also here at the bottom https://github.com/xorpaul/g10k/pull/204/files#diff-900e9873f6417c9eea63c4ed0761750bd4f836dca36020932d8414a1312076a3

Anyway thank you @andni233 for the feature request!