Guillaume Tardif
c2a702c963
Ensure the `docker context inspect default` is not executed in a different context, that might make it fail.
...
Following discussion with @simonferquel, this will strengthen the shell out to get default context, in cases the user has damaged his config file current context or there are issues with context synchronisation between windows host & wsl2.
2020-06-13 10:50:56 +02:00
Guillaume Tardif
e7682682fb
Store context type in metadata to make retrocompatibility with previous contexts easier (potentially switching back and forth)
2020-06-10 18:17:48 +02:00
Djordje Lukic
8400795caf
Add the store to the gRPC context
...
The contexts service needs it
2020-06-09 12:11:59 +02:00
Guillaume Tardif
5675763856
Interactive context create, adding method CreateContextData to CloudService interface, so Cloud Backends can provide a custom context creation method.
2020-06-02 16:04:08 +02:00
Guillaume Tardif
01aaec2dbe
Fix Azure login : allow getting a backend when no corresponding context already exists with an explicit call from the login command. Will be usefull next for context creation with azure interactive things
2020-05-29 11:35:35 +02:00
Guillaume Tardif
d2648da2d9
Fix shell out to docker-classic when invoking
2020-05-27 16:12:40 +02:00
Djordje Lukic
11339761ca
Change the way a context is stored
...
Initially we stored the context data in the `Metadata` of the context
but in hindsight this data would be better of in the `Endpoints` because
that's what it is used for.
Before:
```json
{
"Name": "aci",
"Metadata": {
"Type": "aci",
"Data": {
"key": "value"
}
},
"Endpoints": {
"docker": {}
}
}
```
After:
```json
{
"Name": "aci",
"Type": "aci",
"Metadata": {},
"Endpoints": {
"aci": {
"key": "value"
},
"docker": {}
}
}
```
With this change the contexts that we create are more in line with the contexts the docker cli creates.
It also makes the code less complicated since we don't need to marsal twice any more. The API is nicer too:
```go
// Get a context:
c, err := store.Get(contextName)
// Get the stored endpoint:
var aciContext store.AciContext
if err := contextStore.GetEndpoint(currentContext, &aciContext); err != nil {
return nil, err
}
```
2020-05-22 16:32:43 +02:00
Djordje Lukic
8495500aa2
Add a CliSuite for cli unit tests
...
Makes writing unit tests for commands quite easier
2020-05-22 10:13:56 +02:00
Djordje Lukic
fe36c49246
Use alpine as base image
...
Installing docker on buster is a pain, use alpine to install it
2020-05-20 18:39:10 +02:00
Djordje Lukic
95e07a2134
Add default context to the context ls output
2020-05-20 18:39:10 +02:00
Djordje Lukic
3891c8c414
Put all magic strings in variables in context store
2020-05-18 16:42:06 +02:00
Guillaume Tardif
7edc6659a2
Add unit tests for login process
2020-05-15 10:28:31 +02:00
Guillaume Tardif
1e19d977e0
Initial functional login command : added Cloud API with generic Login()
2020-05-15 10:04:22 +02:00
Djordje Lukic
a506b7f4e9
Fix `make protos`
...
The base target for protos was missing goimports, which we run after
making protos so that the linter doesn't fail on generated code
2020-05-14 21:53:14 +02:00
Djordje Lukic
7b26e8e836
Faster build
...
* Run in parallel
* lint
* test/build/e2e test
* use cache for go
* do not use docker for building
* remove useless dependencies from the base image
Build time passes from 5 minutes to 1 minute 30 seconds
2020-05-14 21:16:31 +02:00
Christopher Crone
ad8a16a922
Do not allow changing default context
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-14 17:10:24 +02:00
Christopher Crone
d46398dbef
Refactor config into package
...
* Move CLI config management into cli/config
* Add ability to save current context
* Remove ability to rename the config file as this was never used
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-14 17:10:20 +02:00
Christopher Crone
3c43606a20
Add remove function to context store
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-12 12:05:00 +02:00
Christopher Crone
4788dd5b93
Use common errors in context store
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-12 12:05:00 +02:00
Christopher Crone
144ee29645
Fix function description typo
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-11 15:49:14 +02:00
Djordje Lukic
4e9a4185af
Add `make lint` and run it on CI
2020-05-05 10:50:30 +02:00
Djordje Lukic
24c035e822
Add comments on exported items, remove example command
...
Also add `make lint` to run the linter
2020-05-05 10:27:44 +02:00
Djordje Lukic
0af5afe440
Move the proxy in the server package
2020-04-30 12:20:04 +02:00
Djordje Lukic
8571cf5a04
Create a new client on each request
...
`docker serve` doesn't need a context any more, the server takes the
current context from the request metadata and creates a new client
2020-04-30 12:07:26 +02:00
Djordje Lukic
9ea91791b4
Change the current context of the client on each request
...
* the interceptor takes the current context from the metadat
* each handler needs to call `client.SetContext()` before using the
sevices
2020-04-30 12:07:26 +02:00
Djordje Lukic
f4bde8cb89
Multiple backend for the cli
...
* implement a little azure backend
* implement an example backend
* use the right backend from the context
2020-04-30 11:01:04 +02:00
Djordje Lukic
551eb2326f
ACI context creation
...
And remove gRPC stuff from the client for now
2020-04-29 19:08:58 +02:00
Ulysses Souza
3380c9d459
Refactor store.New
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-04-27 18:56:37 +02:00
Djordje Lukic
e6597d6139
Don't cd into a directory before building
...
We pass the directory to build to the `go build` command
2020-04-27 15:42:59 +02:00
Djordje Lukic
756836ffab
Use testify/suite and testify/require
2020-04-27 11:45:23 +02:00
Djordje Lukic
10bc4b93f6
Call moby if the command is unknown
...
Will also check if the context is an original docker context
2020-04-27 11:33:16 +02:00
Djordje Lukic
e2c7370a82
Implement context list
2020-04-26 22:07:50 +02:00
Djordje Lukic
3bb4fe163c
Add `docker context create` command
...
This creates a context with a name and a type
2020-04-26 19:42:20 +02:00
Guillaume Lours
8db55e8c5c
Use v2 of urfave/cli
...
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2020-04-23 09:43:53 +02:00
Djordje Lukic
4b2c8ae9cf
Call original docker on moby context
...
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2020-04-20 21:16:03 +02:00
Guillaume Lours
a8403241e4
Add default shellout to engine if no context specified
...
Improve CLI documentation
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2020-04-20 16:22:15 +02:00
Nicolas De Loof
3dac4df803
Implement context loading
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-04-20 16:22:15 +02:00