g10k: Purge does not work

hi,

I probably do something wrong with my environment, but do not find the reason.

g10k.yaml:

---
#postrun:
#  - '/postrun.sh'
cachedir: '/root/.g10k'
deploy:
  purge_levels: ['deployment', 'puppetfile', 'environment']
sources:
  puppet:
    remote: 'git@gitlab.com:<URL>'
    basedir: '/var/lib/docker/volumes/compose-services_puppetserver-code/_data/environments/'
    invalid_branches: 'correct_and_warn'
    prefix: p
git:
forge:

command:

./g10k -config g10k.yaml -verbose

My understanding is that this should purge the basedir by removing stale directories.

version:

g10k  v0.8.15  Build time: 0.8.15 UTC

Any suggestion, what’s wrong with my setup? Thanks in advance,

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Thanks for the response.

I was able to now get this to work by having my compile masters all sync the entire control repo every time. That’s not optimal - the build, while still fast, is 2-3x slower now.

If I’m understanding how g10k works correctly, the current g10k behavior is a big, undocumented divergence from how r10k works. When deploying via r10k with r10k deploy environment, any environments without a corresponding git remote branch are deleted from the master. I expected g10k to work in a similar fashion, given this portion of the g10k readme:

Starting with v.0.9.0 g10k supports the r10k-like purge behaviour of stale content with the different configuration settings purge_level and purge_allowlist as documented here for purge_levels and here for purge_allowlist

The r10k behavior seems excellent to me, since if you are creating dynamic environments on the regular and not deleting them, your build masters will quickly get loaded up with old, unnecessary environments.

If you can confirm for me that the current behavior is what you are looking for, I’d be happy to put in a PR with a change to the readme.