g10k icon indicating copy to clipboard operation
g10k copied to clipboard

Add support for strip_component

Open andni233 opened this issue 1 year ago • 1 comments

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.

andni233 avatar Oct 05 '22 11:10 andni233

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

xorpaul avatar Oct 05 '22 19:10 xorpaul

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

  • env/main
  • main and your strip_component set to env/? The renamed Puppet env would be the same as the original main. Do you know how r10k checks for this?

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!

xorpaul avatar Nov 18 '22 16:11 xorpaul