terraform-provider-flux icon indicating copy to clipboard operation
terraform-provider-flux copied to clipboard

Fix bootstrap running when git history is empty

Open phillebaba opened this issue 1 year ago • 2 comments

The issue does not come from any code in the provider, but from an incompatibility with the current bootstrap code. It does not expect an empty cloned repository when running and will fail. This is not an issue in the CLI bootstrap command because it does not clone the repository before the bootstrap function is run.

https://github.com/fluxcd/flux2/blob/2e4de673b229b3da1ef4aa613080bd05668d9f6e/pkg/bootstrap/bootstrap_plain_git.go#L112-L116

Fixes #365

phillebaba avatar Mar 06 '23 11:03 phillebaba

So there seems to be an error when committing file deletion which causes the repository to become empty.

https://github.com/fluxcd/go-git/blob/2e5c9d01cfc45de34975e567cf7cf5bf13fee082/worktree_commit.go#L156-L158

I am not really sure why this error occurs so more research has to be done.

phillebaba avatar Mar 06 '23 16:03 phillebaba

@phillebaba I am not sure this is an issue anymore as the e2e-github GH action is doing exactly this check as it creates an empty repository and bootstraps via that.

swade1987 avatar Mar 27 '24 20:03 swade1987

Closing we are going to aim to fix this in flux v2.4 by adding the ability to set a kustomization override in the bootstrap command of the CLI.

swade1987 avatar Apr 24 '24 12:04 swade1987