Commit Graph

57 Commits

Author SHA1 Message Date
Nicolas De Loof fed50d79f2
introduce ecs-local context
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-08-31 15:30:05 +02:00
Chris Crone 4c6280b0e9 Rename docker/api -> docker/compose-cli
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-08-21 17:28:39 +02:00
Christopher Crone 207b57ba81 context: Move to gotest.tools
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-08-04 13:39:00 +02:00
aiordache 87245ef727 rename packages ( amazon to ecs and azure to aci )
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-30 11:34:34 +02:00
aiordache 2471e51b39 set build tag for the ecs context and backend
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-30 11:34:34 +02:00
aiordache fb63373a9b remove cluster property from aws context
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-30 11:34:34 +02:00
aiordache 355295696f Create aws context
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-30 11:34:34 +02:00
aiordache 5a26b25709 handle compose on all context types
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-29 11:58:09 +02:00
Guillaume Tardif 43b54ef75a Also remove map[string]string for azure login (tenantId param) 2020-07-10 16:55:44 +02:00
Guillaume Tardif 97d408d25d Replaced map[string] string by existing aciCreateOpts struct for context create 2020-07-10 16:39:09 +02:00
Guillaume Tardif 492ce96dd4 Implement azure logout 2020-07-08 17:48:10 +02:00
Guillaume Tardif 839b1b0b44 Delegate to Moby CLI, to allow executing ecs CLI plugin if user has switched to the AWS context (created by the plugin) 2020-06-25 11:49:28 +02:00
Guillaume Tardif 2824a7a736 Context aci create : check context name does not exists before starting interactive aci create 2020-06-22 18:20:40 +02:00
Djordje Lukic ad72c866cc Add license headers 2020-06-18 16:48:03 +02:00
Guillaume Tardif 3981244701 Fix bug where we shell out to Moby cli only if context == default. We must shell out to Moby cli for any context of type “Moby”, not only the default context. 2020-06-18 09:25:28 +02:00
Guillaume Tardif bbcdad39d5 Renamed docker-classic to “com.docker.com”. 2020-06-17 17:57:53 +02:00
Guillaume Tardif 84cdf58e8a default context type is “moby” 2020-06-15 12:25:35 +02:00
Guillaume Tardif 0de2522079 Renamed Moby backend to “local” backend. This will leave “moby” available for default type contexts 2020-06-15 12:20:03 +02:00
Guillaume Tardif 113350a09d Context create aci is now a subcommand, as Moby and example. Root `docker context create` also allows backward compatibility to create docker contexts as before 2020-06-15 12:19:06 +02:00
Guillaume Tardif d0b2bfbf52 Fix `docker context ls` that was not displaying legacy context endpoints 2020-06-15 12:10:54 +02:00
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