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

feat(api): Environment discovery #468

Merged
merged 4 commits into from
Jan 8, 2021
Merged

feat(api): Environment discovery #468

merged 4 commits into from
Jan 8, 2021

Conversation

sh0rez
Copy link
Member

@sh0rez sh0rez commented Jan 7, 2021

Introduces tanka.ListEnvs for discovering all nested environments starting from any given directory on the filesystem.

This is now implemented by concurrently testing each subfolder of the given directory as to whether it is a valid environment. The recursion stops if any directory is a valid environment.

Switches all occurences of FindBaseDirs to the more performant ListEnvs algorithm.

A quick tk env list on our config repo gave the following:

Before: tk env list  25.40s user 0.69s system 946% cpu 2.757 total
After:  tk env list  1.61s  user 0.37s system 811% cpu 0.243 total

Needs rebasing on #467 once merged

@sh0rez sh0rez added kind/enhancement Improve something existing component/api labels Jan 7, 2021
pkg/tanka/environments.go Show resolved Hide resolved
pkg/tanka/list.go Show resolved Hide resolved
@Duologic
Copy link
Member

Duologic commented Jan 8, 2021

#467 is approved, please merge it and rebase this PR so we can review the changes properly.

@Duologic Duologic mentioned this pull request Jan 8, 2021
sh0rez added 3 commits January 8, 2021 11:25
Introduces `tanka.ListEnvs` for discovering all nested environments
starting from any given directory on the filesystem.

This is now implemented by concurrently testing each subfolder of the
given directory as to whether it is a valid environment. The recursion
stops if any directory is a valid environment.
Switches all occurences of `FindBaseDirs` to the more performant
`ListEnvs` algorithm.

A quick `tk env list` test gave the following:

```
Before: tk env list  25.40s user 0.69s system 946% cpu 2.757 total
After:  tk env list  1.61s  user 0.37s system 811% cpu 0.243 total
```
cmd/tk/args.go Outdated Show resolved Hide resolved
Co-authored-by: Jeroen Op 't Eynde <[email protected]>
@sh0rez sh0rez merged commit 9facf1f into master Jan 8, 2021
@sh0rez sh0rez deleted the list-envs branch January 8, 2021 10:31
@sh0rez sh0rez mentioned this pull request Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/api kind/enhancement Improve something existing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants