307 Commits

Author SHA1 Message Date
Guillaume Tardif
66a83410dd Ensure we have a clear error message in case of wrong setup (previously it would just exit with no error message) 2020-05-26 23:46:02 +02:00
Djordje Lukic
d876f9e779
Merge pull request #153 from rumpl/chore-rename-cli-proto
Chore rename cli proto
2020-05-26 02:25:58 -07:00
Djordje Lukic
7e2d22f5ea Change the path to the contexts protos for node 2020-05-26 10:32:09 +02:00
Djordje Lukic
cb14c05e74 Move the context server into own package
It had notthing to do in the cli package
2020-05-26 10:31:14 +02:00
Djordje Lukic
b8658b3f54 Rename cli protos to contexts 2020-05-26 10:20:13 +02:00
Djordje Lukic
e4b49912a7
Merge pull request #152 from rumpl/chore-dependabot
Add dependabot config file
2020-05-25 07:26:05 -07:00
Djordje Lukic
1304df2b1c
Merge pull request #151 from rumpl/feat-protos
Put all protos inside the `protos` package
2020-05-25 07:24:46 -07:00
Djordje Lukic
bc1a932bd7 Add dependabot config file
It will check and update dependencies once a week
2020-05-25 15:11:29 +02:00
Djordje Lukic
129e675932 Put all protos inside the protos package 2020-05-25 15:04:28 +02:00
Chris Crone
5768ffd526
Merge pull request #148 from rumpl/feat-moby-ports
Add ports to the moby backend
2020-05-25 11:25:51 +02:00
Djordje Lukic
1c3673c421 Add moby backend e2e tests 2020-05-25 10:24:37 +02:00
Djordje Lukic
7b83047dc2
Merge pull request #147 from rumpl/feat-better-context
Change the way a context is stored
2020-05-25 01:11:31 -07: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
2dd98e8a74 Add ports to the moby backend 2020-05-22 16:15:57 +02:00
Djordje Lukic
de33f183df
Merge pull request #139 from rumpl/feat-log-stream
Implement gRPC logging
2020-05-22 06:23:47 -07:00
Chris Crone
8f2c134c79
Merge pull request #145 from docker/feat-test-cache
Add buildkit cache when running unit tests
2020-05-22 13:30:11 +02:00
Djordje Lukic
5d073028be Add buildkit cache when running unit tests
Since running `go test` downloads dependencies we want to have them in
the builder cache
2020-05-22 13:26:30 +02:00
Chris Crone
39cd5036a6
Merge pull request #144 from chris-crone/lint-speed
Use docker build for lint
2020-05-22 13:25:46 +02:00
Christopher Crone
3c5d37326d Use docker build for lint
This approach allows better caching of results (so faster subsequent
lints). It also avoids bind mounts which are slow.

Benchmarks on my machine (2017 MacBook Pro 13"):
* bind mount lint: 2m 38s
* new lint (after docker builder prune): 1m 35s
* old lint (rerun no changes): 2m 38s
* new lint (rerun added println in random Go file): 9s

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-22 13:14:44 +02:00
Chris Crone
0917acfb01
Merge pull request #142 from chris-crone/fix-141
Set random container name if not set
2020-05-22 11:31:16 +02:00
Christopher Crone
88ba591fc3 Seed random with nanosecond time
It's possible that users will run commands more than once a second.
Thus, seeding the random number generator with the current time in
seconds could produce results like the same container name in subsequent
commands.

Seeding with the current time in nanoseconds reduces the probability of
this.

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-22 10:46:54 +02:00
Djordje Lukic
36c01f511b Refactor the interceptors
Avoid having a function that takes in two contexts as parameters
2020-05-22 10:16:04 +02:00
Djordje Lukic
5945e6a56c Implement gRPC logging 2020-05-22 10:16:04 +02:00
Djordje Lukic
6a0c0d7032
Merge pull request #125 from rumpl/feat-default-context
Add default context to the context ls output
2020-05-22 01:14:42 -07: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
Christopher Crone
dd66646c06 Unit test run help
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-21 20:03:06 +02:00
Christopher Crone
0efa67f7d2 Set random container name if not set
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-21 19:28:42 +02:00
Chris Crone
578376aabe
Merge pull request #140 from chris-crone/e2e-helpers
Simplify e2e suite helpers
2020-05-21 13:46:37 +02:00
Christopher Crone
b5156eecc7 Simplify e2e suite helpers
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-21 09:33:08 +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
Chris Crone
eae864ac33
Merge pull request #135 from rumpl/chore-remove-client-deps
Remove gRPC stuff from the client
2020-05-20 18:17:50 +02:00
Chris Crone
3c3b84f542
Merge pull request #138 from chris-crone/refactor-e2e-suite
Refactor e2e suite code
2020-05-20 18:17:01 +02:00
Christopher Crone
7d49706acf Refactor e2e suite code
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 18:08:07 +02:00
Guillaume Tardif
3d2d81b428
Merge pull request #118 from chris-crone/e2e-suite
Wrap e2e tests in suite
2020-05-20 17:23:01 +02:00
Guillaume Tardif
186289b75f Fix ace e2e tests : also use context store with config dir when registering aci backend 2020-05-20 17:15:56 +02:00
Djordje Lukic
3ffa79f743 Remove gRPC stuff from the client 2020-05-20 16:49:20 +02:00
Christopher Crone
57404a2663 Tidy Go modules
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:57:28 +02:00
Christopher Crone
a8146ad59c Rework e2e tests into suite
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:57:10 +02:00
Christopher Crone
384cb89193 Update dockerignore
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:56:32 +02:00
Christopher Crone
ebe3fbc180 Use config dir for serving API
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:56:07 +02:00
Christopher Crone
058e6203a7 Store config dir in CLI context
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:55:05 +02:00
Djordje Lukic
523681659c
Merge pull request #127 from rumpl/add-pull-request-template
Add pull request template
2020-05-20 05:44:19 -07:00
Christopher Crone
b7fb7e2e84 Allow setting config dir with env var
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 14:39:02 +02:00
Djordje Lukic
e902e2ad93 Add pull request template 2020-05-20 14:36:46 +02:00
Guillaume Tardif
d218c0745e
Merge pull request #121 from gtardif/docker-classic
delegate Moby to docker-classic binary, link docker-classic in e2e tests
2020-05-20 14:28:35 +02:00
Guillaume Tardif
2610b986fd delegate Moby to docker-classic binary, link docker-classic in e2e tests 2020-05-20 14:23:29 +02:00
Guillaume Tardif
c1875a219c
Merge pull request #72 from ulyssessouza/add-aci-volumes
Add volumes to run command
2020-05-20 14:18:30 +02:00
Ulysses Souza
d2fece3311 Fix linter problems
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-20 10:16:36 +02:00
Ulysses Souza
762f462d80 Get "run" test back to main function
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-20 10:16:34 +02:00