-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces an envtest binary manager tool. It can download binaries from GCS, list available versions, print out help for switching between them, and remove old ones. By default, it downloads binaries into an OS-specific cache directory, as per the OS's conventions, but this can be overridden.
- Loading branch information
1 parent
4aecab5
commit 6d4fed8
Showing
9 changed files
with
1,405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Envtest Binaries Manager | ||
|
||
This is a small tool that manages binaries for envtest. It can be used to | ||
download new binaries, list currently installed and available ones, and | ||
clean up versions. | ||
|
||
To use it, just go-install it on 1.16+ (it's a separate, self-contained | ||
module): | ||
|
||
```shell | ||
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
``` | ||
|
||
For full documentation, run it with the `--help` flag, but here are some | ||
examples: | ||
|
||
```shell | ||
# download the latest envtest, and print out info about it | ||
setup-envtest fetch | ||
|
||
# download the latest 1.19 envtest, and print out the path | ||
setup-envtest fetch -k '1.19.+' -p path | ||
|
||
# switch to the most recent 1.21 envtest on disk | ||
source <(setup-envtest switch -k '1.21.*' -p env) | ||
|
||
# list all available local versions for darwin/amd64 | ||
setup-envtest list-installed --os darwin --arch amd64 | ||
|
||
# remove all 1.16 versions from disk | ||
setup-envtest cleanup -k '1.16.*' | ||
``` | ||
|
||
## Where does it put all those binaries? | ||
|
||
By default, binaries are stored in an OS-specific cache directory, as per | ||
the OS's conventions (see Go's `os.UserCacheDir`). | ||
|
||
For example, on Linux this is `$XDG_CACHE_DIR`, or just `~/.config` if | ||
that's unset. | ||
|
||
There's an overall folder that holds all files, and inside that is | ||
a folder for each version/platform pair. The exact directory structure is | ||
not guarnateed, except that the leaf directory will contain the names | ||
expected by envtest. You should always use `setup-envtest fetch` or | ||
`setup-envtest switch` (generally with the `-p path` or `-p env` flags) to | ||
get the directory that you should use. |
Oops, something went wrong.