Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flake.nix and flake.lock as allowed files when initializing a project #4487

Open
atkrad opened this issue Jan 13, 2025 · 3 comments
Open
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@atkrad
Copy link

atkrad commented Jan 13, 2025

What do you want to happen?

When I attempt to initialize a new project, I encounter the following error:

kubebuilder init --domain example.com --repo example.com/example-operator

Error:

Error: failed to initialize project: unable to run pre-scaffold tasks of "base.go.kubebuilder.io/v4": target directory is not empty (only go.mod, go.sum, files and directories with the prefix ".", files with the suffix ".md" or capitalized files name are allowed); found existing file "flake.lock"

It seems that only specific files, such as go.mod, go.sum, or Markdown files, are accepted in the target directory. However, many developers use Nix to manage dependencies, which requires files like flake.nix and flake.lock to be present in the directory for dependency installation.

To improve compatibility, it would be a good idea to accept flake.nix and flake.lock as allowed files during project initialization.

Extra Labels

No response

@atkrad atkrad added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 13, 2025
@camilamacedo86
Copy link
Member

Hi @atkrad,

Thank you for raising this. 🥇

The check is only done when you create the project. If you add these files afterwards, the issue would not be raised.

This aims to prevent users from scaffolding a project in a directory with files that could impact its functionality. However, IHMO we can change this implementation.

See where it is currently done: kubebuilder init.go

Instead of using an allowed list, we could implement a deny list. For example:

  • Deny if the directory contains .go files or .yaml files.
  • Allow any other extensions.

What do you think? Would you like to work on this?

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Jan 17, 2025
@sbin64
Copy link

sbin64 commented Jan 19, 2025

@camilamacedo86 I would love to give it a try

@atkrad wanna try out? lmk! thanks

@camilamacedo86
Copy link
Member

Go forward, please feel free to raise a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants