From 65a2d8ad13fd8d92e936b629870db38fdea5ebdd Mon Sep 17 00:00:00 2001 From: Graham Dennis Date: Thu, 19 Dec 2019 01:26:47 +1100 Subject: [PATCH] Fix parsing of docker-compose output. (#424) Set the `COLUMNS` environment variable to an artificially large value for the `docker-compose` process. This works around newer versions of docker-compose (at least 1.25.0-rc4+) which adjust their output based on the width of the terminal. --- changelog/@unreleased/pr-424.v2.yml | 9 +++++++++ .../docker/compose/connection/DockerMachine.java | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 changelog/@unreleased/pr-424.v2.yml diff --git a/changelog/@unreleased/pr-424.v2.yml b/changelog/@unreleased/pr-424.v2.yml new file mode 100644 index 000000000..e25eea800 --- /dev/null +++ b/changelog/@unreleased/pr-424.v2.yml @@ -0,0 +1,9 @@ +type: fix +fix: + description: |+ + Fix parsing of docker-compose output + + Set the `COLUMNS` environment variable to an artificially large value for the docker-compose process. This works around newer versions of docker-compose (at least 1.25.0-rc4+) which adjust their output based on the width of the terminal. + + links: + - https://github.com/palantir/docker-compose-rule/pull/424 diff --git a/docker-compose-rule-core/src/main/java/com/palantir/docker/compose/connection/DockerMachine.java b/docker-compose-rule-core/src/main/java/com/palantir/docker/compose/connection/DockerMachine.java index 85d382d1e..d6525fe73 100644 --- a/docker-compose-rule-core/src/main/java/com/palantir/docker/compose/connection/DockerMachine.java +++ b/docker-compose-rule-core/src/main/java/com/palantir/docker/compose/connection/DockerMachine.java @@ -155,6 +155,10 @@ public DockerMachine build() { String hostIp = new RemoteHostIpResolver().resolveIp(dockerHost); Map environment = ImmutableMap.builder() + // 2019-12-17: newer docker-compose adjusts its output based on the number of columns available + // in the terminal. This interferes with parsing of the output of docker-compose, so "COLUMNS" is + // set to an artificially large value. + .put("COLUMNS", "10000") .putAll(dockerEnvironment) .putAll(additionalEnvironment) .build();