xorpaul/g10k

Deleted files are not removed by g10k

Closed this issue ยท 13 comments

Hey,
I'm using g10k 0.8.9
The content of the Puppetfile is

moduledir '/iliag/modules'

mod 'lputils',
  :git => "git@lpgithub.lp.net:production/puppet-lputils.git",
  :branch => 'master'

and I'm running the command

g10k -verbose -puppetfile install

The first time the g10k fetches all files from the "puppet-lputils" git repository.
Then, I delete a file in the git and re-run the g10k command.
After the run, the file I have deleted in git is not deleted from the file-system :0

Is there something I'm missing?

Nope, I can reproduce this error.

Let me have a look why it doesn't get deleted, though g10k says that it needs to sync the affected module. ๐Ÿค”

it's a long standing issue.
I wanted to open this same issue a while ago, but I was always forgetting, because in the end it kept working, even with some extra stale file left around.

@maxadamo I've noticed that I currently do not purge stale content in Puppetfile mode.
Do you also use g10k in Puppetfile mode?

yes, Puppetfile.

+1
Any ETA?

Hi ... I recently moved G10K to our production env. and we are experiencing the exact same issue. Guys is there an ETA on this fix, its really important to us :)

Should be fixed with https://github.com/xorpaul/g10k/releases/tag/v0.8.10

For now I'm simply purging and redeploying every updated git module in -puppetfile mode.

I would need more time to implement the correct and possibly more efficient purging behavior, but to be honest I'm surprised so many of you use g10k in -puppetfile mode.

I've always thought this mode is somewhat useful on developer workstations, but not on Puppetservers.

TODO: add a test for this issue

Hey,
I have tried to test the new version and it has 2 issues:

  1. You still print "g10k version 0.8.9 Build time: 2020-07-01_10:56:45 UTC"
  2. It fails with:

2020/07/01 09:35:24 purgeDir(): os.RemoveAll() error: removing dir failed: unlinkat /etc/puppet/production/prodmodules/modules/lputils/files/mgmt/infra/scripts/lpsnap/config: directory not empty
2020/07/01 09:35:24 purgeDir(): syscall.Unlink() error: removing link failed: is a directory

Man that's the first time, that adding the version number inside the binary was really helpful ๐Ÿ˜„

There was a bug in my build_release.sh script, so it did upload older versions into the release.

I've updatem them, please try again.

./g10k -version
g10k version 0.8.10 Build time: 2020-07-01_14:37:25_v0.8.10 UTC

Hey,
I have tested the new version, but I'm afraid there still some missing logic.
I have used version 0.8.9 and it fetched a certain module and created all files.
Then, I have deleted some of the files on the git version of the module.
The 0.8.9 version didn't delete them.

I have downloaded 0.8.10 and run the code.
It still didn't delete the files.
I have created an additional file in that module, and only now the g10k purged all older files.

I think it's related to the way you "mark" when you need to re-fetch data.
I tried to use the "-force" flag with a hope to "mark" all modules to be re-downloaded, but with no luck :(

Is there a way to workaround this issue? (other than creating a dummy file in each git module)
Thanks !

Are we really talking about removing a file from the module git repository and commiting it and pushing it?

Not that you're doing a different thing that I'm thinking of ๐Ÿ˜

Any update on this, I would really like to help, but I can't reproduce g10k not fully purging and updating a module if the latest commit hash changes.

Can you remove a file from a git module and also do a -debug g10k run after that?
Then I would be able to see if g10k thinks that the latest commit hash of the module has or hasn't changed.

I think you can close this PR.
As I don't have the environment to reproduce anymore.

The 0.8.10 version fixed my initial issue :)
Thanks !