Граф коммитов

763 Коммитов

Автор SHA1 Сообщение Дата
Laura Brehm 8a400d0c4f
scout hint: tell user logging in is required (#2262)
The `docker scout quickview` hint, displayed
after a user pulls or builds an image, only
works if the user is logged in to Hub.

Check if user isn't logged in, and make hint
more explicit in this case.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-08-25 09:15:42 -04:00
Djordje Lukic d22f3a858a
login: Remove the PAT message, it's in docker/cli now (#2261)
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-08-02 13:19:03 -04:00
Matt Landis accd15cc05 compose-cli: fix PAT detection for PAT suggestion 2023-07-25 15:31:48 -04:00
Yves Brissaud eb0c44c6ef
chore: handle BUILDKIT_PROGRESS to disable hints
the same way we check --progress flag, if it exists, disable

Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-15 15:59:58 +02:00
Yves Brissaud 9a3433477b
chore: fix header dates
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-15 15:16:28 +02:00
Yves Brissaud 8371dab4ae
ref: use `plugins` part of config file
To avoid any conflict with the CLI, use the `plugins` section of the
config. This section is read and saved by the CLI without the risk to
remove the value in there. So it's a safe way to deal with this feature.

As it's a cross plugin configuration (now for scout but goal is wider
than that) then put it under a generic `-x-cli-hints` name so that other
plugins might use it if needed.

Value can be true/false, but is parsed against these exact two values
instead of using the ParseBool.

Both the environment variable and the config value are parsed the same
way.

Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-13 10:19:22 +02:00
Yves Brissaud fac770ab1d
fix: ignore short flags too when finding pulled image
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-12 15:41:29 +02:00
Yves Brissaud 1ceb12ae77
chore: manage CLI Hints enable/disable behaviour
- cliHints entry in config.json
- if not present, enabled by default
- can be overridden by the DOCKER_CLI_HINTS environment variable

Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-12 14:39:50 +02:00
Yves Brissaud 90058ec005
ref: suggest management and check needed flags
only display the hints in main case, without progress, output or push
flags

Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-12 10:20:37 +02:00
Yves Brissaud 62c2e00acc
ref: get pulled image
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-06 18:32:14 +02:00
Yves Brissaud 635db3c338
feat: display docker scout hints on build and pull
On `docker build` and `docker pull` commands, display a hint to
`docker scout quickview`.
Hints are disabled if quiet flag is used or if `DOCKER_SCOUT_HINTS`
environment variable is set to a false (according to Go) value:
  `0`, `f`, `F`, `false`, `FALSE`, `False`

In case of a `docker build` the `docker scout quickview` command doesn't
need an argument as it will take the most recently built image by
default.
In case of a `docker pull` the pulled image is extracted from the
command arguments.

Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
2023-06-06 11:38:55 +02:00
Guillaume Lours a0eabb3bb3
Merge pull request #2249 from milas/adjust-compose-events
metrics: adjust Compose event collection
2023-06-02 13:18:20 +02:00
pvalverde 61d6b02465
feat: added additional subcommands
Signed-off-by: pvalverde <91528455+paco-valverde@users.noreply.github.com>
2023-06-02 12:30:50 +02:00
Milas Bowman b821810726 metrics: adjust Compose event collection
* for per-invocation events, only look at Compose `alpha`
  commands

* for aggregated events, include Compose `alpha` commands

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-06-01 16:36:03 -04:00
pvalverde 97551730c0
feat: scout command metrics
Signed-off-by: pvalverde <91528455+paco-valverde@users.noreply.github.com>
2023-04-11 20:07:09 +02:00
Milas Bowman 784377898f metrics: track and report non-aggregated events
Currently, "usage" reports are sent, which are aggregated.
Add "event" variant, which won't be aggregated.

For compatibility, the "usage" events remain and nothing has
changed in terms of how they parse the command args, for example.
This will ensure continued functioning of anything that relies
on these metrics.

For the "event" variants, the CLI parsing is slightly different
in an attempt to improve data analysis capabilities while still
being respectful of user privacy (i.e. only known values of Docker
CLI commands/flags are ever recorded). Additionally, execution
duration information is now reported with these events.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-08 14:17:04 -05:00
Milas Bowman e7d8d05d99 metrics: initial logic for command execution duration
Add a timer around command invocations to be reported with metrics.
This isn't actually sent anywhere currently, as it's meant for
evented data which is forthcoming. (We could report it with the
current events, but it's not clear that there's any value in doing
so.)

The signature for `Track()` has been changed to take an object with
all the fields. This is both for sanity to keep the method from
getting ridiculously long, and to make it easier to unify the usage
(heartbeat) and event code paths by ensuring we have all the data
for both.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-06 17:08:27 -05:00
Milas Bowman 16482c0611 metrics: move helper code from Compose
Compose doesn't actually currently use this code, it's only used
here. Moving it inline so that we can drop it from Compose in the
future or make changes as needed without worrying about this as a
dependency.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-06 16:50:29 -05:00
Milas Bowman 3f6822e196 metrics: add debug implementation
Refactor the metrics client slightly to add the concept of a
"reporter" that actually sends the metrics.

The primary implementation is HTTP-based as before, but a key
difference now is that there's another variant that writes to
a file for simplified debugging. This is activated by setting
the `DOCKER_METRICS_DEBUG_LOG` environment variable to a file
path to write events to as JSON lines.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-02 09:20:32 -05:00
Milas Bowman 020489241f lint: update for Go 1.19 / golangci-lint 1.50.1
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-01 16:04:49 -05:00
Guillaume Tardif 4b1cbd08aa Add share command (docker extension share) in metrics whitelist
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2023-01-19 17:51:10 +01:00
Sebastiaan van Stijn f1aa070b81
cli/mobycli: Exec(): simplify output
The command now was showing 2 informational messages (about PAT and
Scan); the scan one had been there for a while so most users will
know about it by now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-06 21:48:43 +01:00
Nick Santos bb0197e198
cli: fix warnings on 'docker context use'. Fixes https://github.com/docker/cli/issues/3765
Signed-off-by: Nick Santos <nick.santos@docker.com>
2022-09-14 18:17:32 -04:00
CrazyMax 668b262605
build metrics compatibility for next 22.06
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-07-27 17:03:03 +02:00
Nick Sieger 4678a3e780
mobycli: add test for comDockerCli
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-27 09:07:27 -05:00
Nick Sieger 22d68602ae
mobycli: append .exe to com.docker.cli on windows
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-27 09:00:11 -05:00
Nick Sieger fc215287b5
mobycli: update approach for finding cli command to use
1. Use path from env variable `$DOCKER_COM_DOCKER_CLI`
2. Use path formed from parent directory of current process joined with
   `com.docker.cli`
3. Look for `com.docker.cli` on $PATH

Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-26 15:12:11 -05:00
Nick Sieger d8b9310e03
Merge commit '48c999679165e8f0355f32092063ab4f0ceeee42' of https://github.com/crazy-max/compose-cli into cli-binary-path-handling
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-26 14:54:13 -05:00
Piotr Stankiewicz cfa212f15d Fall back to global CLI socket on Linux
DD relies on having the CLI socket available in /var/run when running in
WSL. So in case we can't find the CLI socket in the calling user's home
directory, fall back to /var/run.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@docker.com>
2022-07-25 15:33:00 +02:00
Guillaume Lours 1a01d2f198
update gotest.tools to v3.3.0 which support golang 1.18
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-07-25 12:20:42 +02:00
CrazyMax 1dce98712a
Go 1.18
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-07-24 00:49:08 +02:00
Piotr Stankiewicz f922ff963d Use Docker CLI socket from the User's home directory
We should not rely on having a global path for the Docker CLI socket. On
macOS this forces Docker Desktop to access directories which require
raised privileges. Whereas on Linux we do not create sockets in that
location at all, currently. So look for the Docker CLI socket in the
User's home directory.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@docker.com>
2022-07-22 11:31:22 +02:00
CrazyMax 48c9996791
Allow to override classic cli binary via env var
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-31 07:25:16 +02:00
CrazyMax 8092874d41
metrics: fix unexpected usage output shown on cli
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-15 03:50:45 +02:00
Guillaume Tardif f96ef1970c Add extension commands in command metrics
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2022-04-13 23:01:33 +02:00
Alex Goodman 29cbfa0485
add SBOM management command to metrics
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
2022-03-23 10:45:42 -04:00
CrazyMax 535fb93280
add build metrics
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-22 19:36:19 +01:00
CrazyMax a4ae60a39d
recover missing commands for backward compatibility
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-16 12:20:31 +01:00
CrazyMax 6fd97089b8
sort commands
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-16 12:20:30 +01:00
CrazyMax d3f55aec6d
update commands
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-16 12:20:30 +01:00
Mathieu Champlon 48ad1486ac Revert "signals"
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-11-04 17:14:28 +01:00
Ulysses Souza 5aa293cc04 Fix plugin command delegation
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-03 15:22:52 +01:00
Lorena Rangel 3ff346838a point to correct backend when switching context
Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
2021-10-18 14:15:04 +02:00
Lorena Rangel 7829bd2459 bump protoc and update .proto files
Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
2021-10-06 15:43:01 +02:00
Mathieu Champlon 8b76602054
Merge pull request #1879 from ndeloof/signals
signals
2021-09-21 12:09:52 +02:00
Ulysses Souza 81c53672d5 Linter fixes
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-09-18 15:50:25 +02:00
Ulysses Souza 25b335924c Store context type in the context for reusing
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-09-17 19:26:24 +02:00
Ulysses Souza fa7e0632ba Add checks for unsupported flags
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-09-17 10:19:02 +02:00
Nicolas De Loof 07f6f804a9 use docker/compose/v2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-17 10:19:02 +02:00
Nicolas De Loof c944c970ab
use nicer imports
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-08-31 16:58:19 +02:00