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

When sources are deleted manually it is not possible to run protofetch fetch again #27

Open
saraiva132 opened this issue May 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@saraiva132
Copy link
Collaborator

Since we are using git worktree to build sources directory tree, when sources are deletes manually (from ~./protofetch/cache), it is not possible to run protofetch fetch since the worktree already exists (the metadata). Thus, that metadata needs to also be deleted for it work again. The library does not support git worktree removal at the time this ticket was opened.

Tip: Look at fetch::fetch method

Edit: Since now we copy proto files as the actual output that is fine to delete. Only the folder inside cache with the source code errors out.

@saraiva132 saraiva132 changed the title When sources are deleted manually it is not possible to run protofetch fetch again [Bug] When sources are deleted manually it is not possible to run protofetch fetch again May 28, 2022
@saraiva132 saraiva132 added the bug Something isn't working label May 28, 2022
@saraiva132 saraiva132 changed the title [Bug] When sources are deleted manually it is not possible to run protofetch fetch again When sources are deleted manually it is not possible to run protofetch fetch again May 28, 2022
@kriswuollett
Copy link

protofetch.toml:

name = "corp"

[envoy]
url = "github.com/envoyproxy/envoy"
revision = "72d653e2540cc5f77e2acdc1c9a57a10263d74dc"
protocol = "https"
allow_policies = ["envoy/*"]
content_roots = ["api"]

[grpc]
url = "github.com/grpc/grpc"
revision = "b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1"
protocol = "https"
allow_policies = ["grpc/health/v1/*"]
content_roots = ["src/proto"]

[udpa]
url = "github.com/cncf/udpa"
revision = "c52dc94e7fbe6449d8465faaeda22c76ca62d4ff"
protocol = "https"
allow_policies = ["udpa/*"]

Test after deleting proto_src and added that udpa dependency above:

% protofetch fetch                
INFO Resolving github.com/grpc/grpc
INFO Resolving github.com/envoyproxy/envoy
INFO Resolving github.com/cncf/udpa
INFO Wrote lockfile to /Users/kris/Code/appbiotic/corp/protofetch.lock
INFO Fetching dependencies source files...
INFO Copying proto files from corp descriptor...
INFO Found existing worktree for envoy at /Users/kris/.cache/protofetch/dependencies/envoy/72d653e2540cc5f77e2acdc1c9a57a10263d74dc.
ERROR Error while canonicalizing path /Users/kris/.cache/protofetch/dependencies/grpc/b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1: No such file or directory (os error 2)

Only is resolvable if I delete the cache and lockfile and start over:

% protofetch fetch          
INFO Resolving github.com/cncf/udpa
INFO Resolving github.com/grpc/grpc
INFO Resolving github.com/envoyproxy/envoy
INFO Wrote lockfile to /Users/kris/Code/appbiotic/corp/protofetch.lock
INFO Fetching dependencies source files...
INFO Copying proto files from corp descriptor...
INFO Creating new worktree for envoy at /Users/kris/.cache/protofetch/dependencies/envoy/72d653e2540cc5f77e2acdc1c9a57a10263d74dc.
INFO Creating new worktree for grpc at /Users/kris/.cache/protofetch/dependencies/grpc/b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1.
INFO Creating new worktree for udpa at /Users/kris/.cache/protofetch/dependencies/udpa/c52dc94e7fbe6449d8465faaeda22c76ca62d4ff.

It is not clear what is the root issue nor how the user should resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants