Fix purge_allowlist not respected in purgeControlRepoExceptModuledir#246
Draft
Copilot wants to merge 2 commits into
Draft
Fix purge_allowlist not respected in purgeControlRepoExceptModuledir#246Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
The purgeControlRepoExceptModuledir function was deleting all files in a Puppet environment directory (except the module dir) without checking config.PurgeAllowList. This caused directories like .resource_types to be deleted on every g10k run when the control repo changed. Fix by building an allowlist from config.PurgeAllowList before purging and skipping deletion for matching items, consistent with how purgeUnmanagedContent handles DeploymentPurgeAllowList. Co-authored-by: xorpaul <938061+xorpaul@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with preserving .resource_types directory in g10k
Fix purge_allowlist not respected in purgeControlRepoExceptModuledir
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
purge_allowlistentries were silently ignored when g10k detected control repo changes and calledpurgeControlRepoExceptModuledir— everything except the module dir was deleted unconditionally, including user-managed directories like.resource_types.Changes
stale.go: UpdatedpurgeControlRepoExceptModuledirto resolveconfig.PurgeAllowListglob patterns against the environment directory before purging, skipping matched entries — consistent with howpurgeUnmanagedContenthandlesDeploymentPurgeAllowListg10k_test.go: AddedTestPurgeControlRepoExceptModuledirWithAllowListunit test that verifies allowlisted paths (.resource_types,custom.json) survive purge while unlisted paths are removedtests/TestConfigPurgeAllowlistControlRepo.yaml: Test config for the new testExample
With this fix,
.resource_types(or any other allowlisted path) is preserved when g10k resyncs an environment after a control repo change.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
forgeapi.puppet.com/tmp/go-build623816492/b001/g10k.test /tmp/go-build623816492/b001/g10k.test -test.run=TestPurgeControlRepoExceptModuledir$(dns block)/tmp/go-build1277108894/b001/g10k.test /tmp/go-build1277108894/b001/g10k.test -test.paniconexit0 -test.v=true -test.run=TestPurgeControlRepoExceptModuledir$ -test.timeout=2m0s 0.1-go1.25.3.lin--gdwarf-5 /http/httptrace/trace.go ux-amd64/pkg/tool/linux_amd64/compile(dns block)/tmp/go-build161923965/b001/g10k.test /tmp/go-build161923965/b001/g10k.test -test.run=TestPurgeControlRepoExceptModuledir$(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.