Commit Graph

31 Commits

Author SHA1 Message Date
Nicolas De Loof f58f23a6a2
remove ServiceProxy which was introduced for archived compose-cli
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-12-22 14:02:21 +01:00
Rory e1aa4f779b
otel: add args & flags to cli traces (#10974)
Signed-off-by: rvigus <roryvigus@gmail.com>
2023-09-07 16:04:36 -04:00
Milas Bowman e1f8603a62 otel: refactor root command span reporting
* Move all the initialization code out of `main.go`
* Ensure spans are reported when there's an error with the
  command
* Attach the Compose version & active Docker context to the
  resource instead of the span
* Name the root CLI span `cli/<cmd>` for clarity and grab
  the full subcommand path (e.g. `alpha-viz` instead of just
  `viz`)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-06-20 17:25:58 +02:00
Milas Bowman 3c8a56dbf3
trace: add OTEL initialization (#10526)
This is a bunch of OTEL initialization code. It's all in
`internal/` because there are re-usable parts here, but Compose
isn't the right spot. Once we've stabilized the interfaces a bit
and the need arises, we can move it to a separate module.

Currently, a single span is produced to wrap the root Compose
command.

Compose will respect the standard OTEL environment variables
as well as OTEL metadata from the Docker context. Both can be
used simultaneously. The latter is intended for local system
integration and is restricted to Unix sockets / named pipes.

None of this is enabled by default. It requires setting the
`COMPOSE_EXPERIMENTAL_OTEL=1` environment variable to
gate it during development.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-06-08 16:46:07 -04:00
Ulysses Souza 140dc519d3
cli: add shell completion function (#9269)
Integrates PR #9462 with additional fixes/changes.

Additional changes will be required to utilize this.

Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-09-26 13:21:45 -04:00
Ulysses Souza 60363c36df Remove dead warning code
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-03-31 16:42:04 +02:00
Nicolas De Loof c843d373de restore TTY auto-detection using dockerCli.Out.IsTerminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-16 16:34:26 +01:00
Nicolas De Loof 1d4b4e3c8e use docker/cli RunExec and RunStart to handle all the interactive/tty/* terminal logic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-16 16:34:26 +01:00
Nicolas De Loof f86f252a66 composeService to use dockerCli's In/Out/Err streams
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-03 16:34:57 +01:00
Nicolas De Loof 740276f550 handle "stop" event
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-12-09 13:57:52 +01:00
Ulysses Souza e2f33af831 Merge and fix Convert function from `docker/compose-switch`
This also removes the vendoring of the repo
Note that it fixes the problem of double "compose" on calling
the compose plugin with "docker" root flags.
Like in "docker --context default compose version"

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-03 12:17:17 +01:00
Nicolas De Loof 1faa76ee4e
use compose-switch Convert
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-30 09:15:56 +02:00
Ulysses Souza 17354fcc99 Add standalone capacility
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-09-30 02:16:55 +02:00
Nicolas De Loof 5b30accf35
Change URLs to reflect new project home
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-02 09:06:52 +02:00
Nicolas De Loof 1ae9b3cb5d
move compose-cli code into docker/compose/v2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-08-31 19:09:19 +02:00
Nicolas De Loof fcb91096b8
remove all references to cli from compose.v2 cmd package
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-08-31 15:41:20 +02:00
Sebastiaan van Stijn a0db32043e
Do not strip "v" prefix from version when printing
I noticed this when building the binary; `internal.Version` is set to `v2.0.0-beta.4`,
to match the tag.

```bash
GIT_TAG=v2.0.0-beta.4
make COMPOSE_BINARY=bin/docker-compose -f builder.Makefile compose-plugin \
    GOOS=linux \
    GOARCH=amd64 \
    CGO_ENABLED=0 \
    go build \
        -trimpath \
        -ldflags="-s -w -X github.com/docker/compose-cli/internal.Version=v2.0.0-beta.4" \
        -o bin/docker-compose \
        ./cmd
```

However, the binary has the `v` prefix stripped (which caused a check to fail
when packaging):

```bash
/root/rpmbuild/BUILDROOT/docker-compose-plugin-2.0.0.beta.4-0.fc34.x86_64/usr/libexec/docker/cli-plugins/docker-compose docker-cli-plugin-metadata
++ awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }'
+ ver=2.0.0-beta.4
+ test 2.0.0-beta.4 = v2.0.0-beta.4
FAIL: docker-compose version (2.0.0-beta.4) did not match
```

This also looks inconsistent with other binaries and plugins we ship:

```bash
docker info --format '{{json .ClientInfo.Plugins}}' | jq .
[
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.5.1-docker",
    "ShortDescription": "Build with BuildKit",
    "Name": "buildx",
    "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "2.0.0-beta.4",
    "ShortDescription": "Docker Compose",
    "Name": "compose",
    "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.8.0",
    "ShortDescription": "Docker Scan",
    "Name": "scan",
    "Path": "/usr/libexec/docker/cli-plugins/docker-scan"
  }
]
```

Perhaps there was a specific reason for this, but thought I'd open this PR for
discussion (if the v-prefix should not be there, perhaps we should isntead strip
it when setting the version).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-03 15:53:21 +02:00
Nicolas De Loof 49e7f2d45d Move compose v2 implementation under pkg/compose with dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-06-15 15:52:48 +02:00
Nicolas De Loof e2ea24ceb7 move compose-plugin commands under /cmd
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-06-15 15:52:48 +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
Christopher Crone d166ad82f9 Update copyright date
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-04-24 14:39:49 +02:00
Djordje Lukic 29a838ddf5
Merge pull request #15 from glours/find_existing_docker_binary
Use docker binary find in path to fallback to Moby CLI
2020-04-23 11:32:13 +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
Guillaume Lours 8af8924a58 Use docker binary find in path to fallback to Moby CLI
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2020-04-22 23:47:04 +02:00
Djordje Lukic 6bfeda054b Go mods initialized, protos without gogo 2020-04-21 15:07:41 +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 f5aa9638af Add default shellout to engine if no context specified
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2020-04-20 17:16:37 +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
Guillaume Tardif 91951eb03a Rename context to example to make it more explicit, context will be a local command managing contexts (similar to docker-cli context command, adapted here for more generic purpose) 2020-04-07 21:36:25 +02:00
Michael Crosby 37591c714b Add base cli and connection logic
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2020-04-06 11:54:01 -04:00