xorpaul / g10k

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

Treat purge_whitelist as globs, not fixed filenames #169

Closed raphink closed 4 years ago

raphink commented 4 years ago

For example, .resource_types content is purged without this (the directory is ignored, but every file in it is purged).

xorpaul commented 4 years ago

Hmm, if I'm remembering it correctly, using globs made it difficult to also purge matching files inside sub-directories.

purge_whitelist: [ '.resource_types/*.pp' ] Would not delete

└── foo
    └── bar.pp

But I could be wrong.

I'll have to test this again, your glob solution would make more sense to be honest.

raphink commented 4 years ago

I don't see why this would happen with my implementation.

At the moment, it's not possible to avoid purging .resource_types content.

raphink commented 4 years ago

Also, r10k supports globs so it would make sense for g10k to behave the same way.

raphink commented 4 years ago

@xorpaul Anything I can do to help decide on whether to merge this?

xorpaul commented 4 years ago

I needed to adjust the tests to verify if the glob pattern really work.

I've also added github.com/yargevad/filepathx to support the recursive double star pattern.

---
deploy:
  purge_levels: ['deployment', 'puppetfile', 'environment']
  purge_whitelist: [ '.latest_revision', '.resource_types', 'resource_types/*.pp', '**/*.pp'. ]
  deployment_purge_whitelist: [ 'example_hiera_*', '.resource_types' ]

sources:
  example:
    remote: 'https://github.com/xorpaul/g10k-environment.git'
    basedir: '/tmp/out/'
    prefix: true
  example_hiera:
    remote: 'https://github.com/xorpaul/g10k-hiera.git'
    basedir: '/tmp/out/'
    prefix: true

Check out the new release: https://github.com/xorpaul/g10k/releases/tag/v0.8.12