872 Commits

Author SHA1 Message Date
Mike Seplowitz
b6ddddc31a Improve control over ANSI output (#6858)
* Move global console_handler into function scope

Signed-off-by: Mike Seplowitz <mseplowitz@bloomberg.net>

* Improve control over ANSI output

- Disabled parallel logger ANSI output if not attached to a tty.
  The console handler and progress stream already checked whether the
  output stream is a tty, but ParallelStreamWriter did not.

- Added --ansi=(never|always|auto) option to allow clearer control over
  ANSI output. Since --no-ansi is the same as --ansi=never, --no-ansi is
  now deprecated.

Signed-off-by: Mike Seplowitz <mseplowitz@bloomberg.net>
2021-01-26 20:15:15 +01:00
Mark Gallagher
c27c73efae Remove duplicate values check for build.cache_from
The `docker` command accepts duplicate values, so there is no benefit to
performing this check.

Fixes #7342.

Signed-off-by: Mark Gallagher <mark@fts.scot>
2021-01-26 20:15:15 +01:00
Ulysses Souza
318741ca5e Add metrics
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-26 20:15:14 +01:00
Ulysses Souza
e0edc908b5 Fix project_dir to take first file in account
The order of precedence is:
- '--project-directory' option
- first file directory in '--file' option
- current directory

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-12-02 16:59:47 -03:00
Anca Iordache
f1059d75ed
Merge pull request #7866 from luca-nardelli/improve-mandatory-variables-issues
Report which variable fails interpolation when they are mandatory
2020-12-02 20:06:25 +01:00
aiordache
21c07bd76c Move device requests to service_dict to avoid adding another field to config hash
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-12-02 18:12:39 +00:00
aiordache
8f2dbd9b12 Add devices to config hash to trigger container recreate on change
* add unit test
 * update path to compose spec schema in Makefile

Signed-off-by: aiordache <anca.iordache@docker.com>
2020-12-02 18:12:39 +00:00
Ulysses Souza
675c9674e1 Add Makefile including spec download target
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-10-27 13:50:17 +01:00
Luca Nardelli
d51249acf4 Report which variable fails interpolation when they are mandatory
Add default value before raising UnsetRequiredSubstitution

Signed-off-by: Luca Nardelli <luca.nardelli@protonmail.com>
2020-10-15 09:55:04 +02:00
Ulysses Souza
ce59a4c223 Fix port rendering
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-09-24 14:49:26 +02:00
aiordache
fa720787d6 update depends_on tests
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-09-14 18:01:35 +02:00
Kevin Clark
d811500fa0 Added merge for max_replicas_per_node
Signed-off-by: Kevin Clark <kclark@edustaff.org>
2020-09-11 08:01:24 -04:00
Ulysses Souza
fde1c681a7 Preserve the version when specified in the file
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-09-10 13:10:33 +02:00
Ulysses Souza
dff3ce28f4 Fix flake8
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-08-21 19:25:24 +02:00
Ulysses Souza
c447ff8c2c Update API version for docker client
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-08-21 18:11:27 +02:00
Ulysses Souza
5bbd670166 Update tests to use the version on docker client
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-08-21 16:42:00 +02:00
Ryosuke TOKUAMI
35f1334cbd Use docker cli on run when the envvar passed.
Make docker-compose run pass the the cli option
to project.up to build images using docker cli
considering COMPOSE_DOCKER_CLI_BUILD environment
variable.

Signed-off-by: Ryosuke TOKUAMI <mail@pokutuna.com>
2020-08-12 15:42:37 +02:00
alexrecuenco
4d3d9f64b9 Removed Python2 support
Closes: #6890

Some remarks,

- `# coding ... utf-8` statements are not needed
- isdigit on strings instead of a try-catch.
- Default opening mode is read, so we can do `open()` without the `'r'` everywhere
- Removed inheritinng from `object` class, it isn't necessary in python3.
- `super(ClassName, self)` can now be replaced with `super()`
- Use of itertools and `chain` on a couple places dealing with sets.
- Used the operator module instead of lambdas when warranted
    `itemgetter(0)` instead of `lambda x: x[0]`
    `attrgetter('name')` instead of `lambda x: x.name`
- `sorted` returns a list, so no need to use `list(sorted(...))`
- Removed `dict()` using dictionary comprehensions whenever possible
- Attempted to remove python3.2 support

Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
2020-08-11 17:45:13 +07:00
Anca Iordache
d4f55a721d
Merge pull request #7457 from EricHripko/run-healthy
[Compose Spec] Make 'run' behave in the same way as 'up'
2020-08-07 10:31:22 +02:00
Eric Hripko
06462cd604 Make run behave in the same way as up
Signed-off-by: Eric Hripko <ehripko@bloomberg.net>
2020-08-06 23:11:39 +01:00
Anca Iordache
a2095a2a0c
Merge pull request #7510 from hartwork/issue-7501-stop-using-deprecated-assertequal
tests: Stop using deprecated assertEquals (fixes #7501)
2020-08-03 15:29:39 +02:00
aiordache
cb56036a6e rename schema to compose_spec
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-09 15:52:46 +02:00
aiordache
c06b30548d cleanup compatibility and tests
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-08 19:07:38 +02:00
aiordache
b78c1ec193 Merge 2.x and 3.x schemas
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-07-08 12:31:39 +02:00
Sebastian Pipping
59d03b1d5e tests: Stop using deprecated assertEquals (fixes #7501)
Signed-off-by: Sebastian Pipping <sebastian@pipping.org>
2020-06-09 19:59:36 +02:00
Bastian Venthur
5529376d4c Removed six
Signed-off-by: Bastian Venthur <bastian.venthur@flixbus.com>
2020-06-03 17:43:16 +02:00
Bastian Venthur
e8424d5ae0 Removed Python2 support
Closes: #6890

Signed-off-by: Bastian Venthur <bastian.venthur@flixbus.com>
2020-06-03 17:37:47 +02:00
Ulysses Souza
d412a1e47f
Merge pull request #6937 from apollo13/issue6871
Properly escape values coming from env_files, fixes #6871
2020-02-24 11:52:14 +01:00
Anca Iordache
09c80ce49b test update - remove 'placement' from unsupported fields
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2020-02-07 13:50:06 +01:00
Florian Apolloner
f17e7268b0 Properly escape values coming from env_files, fixes #6871
Signed-off-by: Florian Apolloner <florian@apolloner.eu>
2020-01-28 16:33:28 +01:00
Ulysses Souza
409a9d8207
Merge pull request #7150 from ulyssessouza/add-python-dotenv
Add python-dotenv to delegate `.env` file processing
2020-01-27 14:48:41 +01:00
Ulysses Souza
6d2658ea65 Add python-dotenv
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-01-27 13:50:34 +01:00
Ben Thorner
a6b602d086 Support attaching to dependencies on up
When using the 'up' command, only services listed as arguments are
attached to, which can be very different to the 'no argument' case
if a service has many and deep dependencies:

   - It's not clear when dependencies have failed to start. Have to run
'compose ps' separately to find out.
   - It's not clear when dependencies are erroring. Have to run 'compose
logs' separately to find out.

With a simple setup, it's possible to work around theses issue by
using the 'up' command without arguments. But when there are lots of
'top-level' services, with common dependencies, in a single config,
using 'up' without arguments isn't practical due to resource limits
and the sheer volume of output from other services.

This introduces a new '--attach-dependencies' flag to optionally attach
dependent containers as part of the 'up' command. This makes their logs
visible in the output, alongside the listed services. It also means we
benefit from the '--abort-on-container-exit' behaviour when dependencies
fail to start, giving more visibility of the failure.

Signed-off-by: Ben Thorner <ben.thorner@digital.cabinet-office.gov.uk>
2020-01-16 13:41:54 +00:00
Ulysses Souza
2cb1b4bd5b
Merge pull request #6873 from frenzymadness/pytest_compatibility
Bump Pytest and add refactor compatibility with new version
2020-01-10 17:09:33 +01:00
Lumir Balhar
a436fb953c Remove indentation from test YAML
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
2020-01-10 08:41:11 +01:00
Sergey Fursov
c818bfc62c support PyYAML up to 5.x version
Signed-off-by: Sergey Fursov <geyser85@gmail.com>
2020-01-09 12:30:51 +01:00
Lumir Balhar
73cc89c15f Use stdlib modules instead of deprecated pytest fixtures
Signed-off-by: Lumír Balhar <lbalhar@redhat.com>
2020-01-09 07:01:44 +01:00
Sebastiaan van Stijn
33eeef41ab Remove "bundle" subcommand and support for DAB files
Deploying stacks using the "Docker Application Bundle" (`.dab`) file
format was introduced as an experimental feature in Docker 1.13 /
17.03, but superseded by support for Docker Compose files in the CLI.

With no development being done on this feature, and no active use of the file
format, support for the DAB file format and the top-level `docker deploy` command
(hidden by default in 19.03), will be removed from the CLI, in favour of
`docker stack deploy` using compose files.

This patch removes the `docker-compose bundle` subcommand from Docker Compose,
which was used to convert compose files into DAB files (and given the above,
will no longer be needed).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-08 16:42:49 +01:00
Ulysses Souza
702dd9406c
Merge pull request #7093 from ulyssessouza/warn-invalid-version
Validate version format on formats 2+
2020-01-08 10:47:01 +01:00
ulyssessouza
7f49bbb998 Validate version format on formats 2+
Signed-off-by: ulyssessouza <ulyssessouza@gmail.com>
2020-01-07 18:37:47 +01:00
Ulysses Souza
37eb7a509b Decode APIError explanation to unicode before usage
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-01-06 16:00:34 +01:00
Ulysses Souza
cba8ad474c Fix by adding an assert to make the comparison effective
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-01-06 15:53:32 +01:00
Djordje Lukic
f8142a899c Cleanup all open files
If the fd is not closed the cleanup will fail on windows.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2019-10-28 15:36:05 +01:00
Guillaume Lours
386bdda246 Format image size as decimal to be align with Docker CLI
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2019-10-18 12:50:38 +02:00
Aleksandr Mezin
74f892de95 Add test to verify same file 'extends' optimization
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2019-10-09 11:36:17 +06:00
ulyssessouza
eca358e2f0 Fix secret missing warning
Signed-off-by: ulyssessouza <ulyssessouza@gmail.com>
2019-09-27 09:10:49 +02:00
Ulysses Souza
70ead597d2 Add tests to 'get_secret' warnings
Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-09-09 10:04:05 +02:00
Silvin Lubecki
1566930a70
Merge pull request #6862 from deathtracktor/master
Fix KeyError when remote network labels are None.
2019-09-06 11:13:48 +02:00
Danil Kister
a5fbf91b72 Prevent KeyError when remote network labels are None.
Signed-off-by: Danil Kister <danil.kister@gmail.com>
2019-09-05 21:36:10 +02:00
Ulysses Souza
47d170b06a Fix race condition on watch_events
Avoid to attach to restarting containers and ignore
race conditions when trying to attach to already
dead containers

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-09-04 17:55:05 +02:00