Commit Graph

330 Commits

Author SHA1 Message Date
Djordje Lukic dae54a3c1f
Merge pull request #166 from docker/grpc_container_errfix
Fix slight bug in error handling
2020-06-03 04:12:47 -07:00
Guillaume Tardif 1c94893d2f Fix slight bug in error handling 2020-06-03 12:20:49 +02:00
Chris Crone 21b6a2ae71
Merge pull request #160 from chris-crone/dockerfile-improvements
Dockerfile improvements
2020-06-02 12:15:43 +02:00
Christopher Crone 654f9ebbaf Tidy Makefiles
* Make BINARY mutability explicit
* Default docker build output type is local so use this

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-06-02 11:58:29 +02:00
Christopher Crone 9920fe2284 Remove unused variables
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-06-02 11:58:29 +02:00
Christopher Crone 247fa56ee1 More Dockerfile best practices
* Use mounts for RUN commands to avoid creating extra layers
* Use built-in platform support

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-06-02 11:58:24 +02:00
Djordje Lukic 3a2e16dc7a
Merge pull request #163 from docker/chore-remove-backend
Remove unused backend proto
2020-06-02 00:56:37 -07:00
Guillaume Tardif ec5e61b645
Merge pull request #162 from docker/login_command
Move login to root command
2020-06-02 09:42:38 +02:00
Djordje Lukic 45b672a39d Remove unused backend proto 2020-06-02 09:41:57 +02:00
Guillaume Tardif e2b9f5bc57 Move login to root command, delegate to classic login when only one arg and not dot in it 2020-06-01 22:55:46 +02:00
Guillaume Tardif f1fb80ecc5
Merge pull request #161 from docker/context_inspect
Add docker context inspect command relying on classic docker
2020-05-29 15:51:10 +02:00
Djordje Lukic 6830724ab9
Merge pull request #159 from docker/fix_azure_login
Fix Azure login : no need for ACI context first
2020-05-29 06:23:27 -07:00
Guillaume Tardif 528d47ce08 Add docker context inspect command relying on classic docker 2020-05-29 12:02:14 +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
Christopher Crone 9097b1f750 Add .git to .dockerignore
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-29 11:29:28 +02:00
Djordje Lukic 832651b1dc
Merge pull request #157 from docker/kill_child_process_on_cancel
Kill child process "docker-classic" on cancel
2020-05-28 04:53:47 -07:00
Guillaume Tardif c8acbc33fd
Merge pull request #158 from docker/azure_backend_dependency
Remove azure resourceGroupClient from backend initialisation.
2020-05-28 10:52:01 +02:00
Guillaume Tardif a948b6e1d0 Remove azure resourceGroupClient from backend initialisation. Several advantages :
- less dependencies to init backend. (Will need to work more on this to make login command not need an existing subscription ID)
- backend does not get login token at init time. For a long running process (grace server) this would cause issues with token lifetime
- we benefit from the client config (polling options especially) set in aci.go, without duplicating stuff
2020-05-28 10:16:42 +02:00
Guillaume Tardif ea98a2dd78 Fix docker-classic creation makefile target 2020-05-27 21:14:07 +02:00
Guillaume Tardif cc46f84043 Forward closing signal to docker-classic when closing docker. Note this will not forward Kill signal, impossible to intercept / process this one. 2020-05-27 18:38:51 +02:00
Guillaume Tardif e630ace677
Merge pull request #154 from docker/fix_context_inspect_shellout
Fix shell out to docker-classic when invoking
2020-05-27 17:02:01 +02:00
Guillaume Tardif d2648da2d9 Fix shell out to docker-classic when invoking 2020-05-27 16:12:40 +02:00
Djordje Lukic 4c4ebbdb56 Merge pull request #155 from docker/fix_shellout_no_error_message
Ensure we have a clear error message in case of wrong setup for docker-classic
2020-05-27 01:05:19 -07:00
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