compose icon indicating copy to clipboard operation
compose copied to clipboard

feature: compose config should purge nested x-* tags

Open hholst80 opened this issue 3 years ago • 3 comments

Version

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Description

docker-compose config should purge nested x-fields

Design idea

input

version: '2'

x-common: &common
  volumes: &common-volumes
  - /data:/data
  x-volumes: &common-cache-volumes
  - /data:/data
  - /cache:/cache

services:
  service-foo:
   <<: *common
   image: docker.io/hello-world:latest

Expected output:

$ docker-compose config
version: '2'
services:
  service-foo:
    image: docker.io/hello-world:latest
    volumes:
    - /data:/data:rw

Actual output:

services:
  service-foo:
    image: docker.io/hello-world:latest
    volumes:
    - /data:/data:rw
    x-volumes:
    - /data:/data
    - /cache:/cache
version: '2'

hholst80 avatar Jan 07 '22 11:01 hholst80

x-* syntax is actually used by the Compose Specification to let Compose implementations define custom extensions (like x-aws-cluster for ECS deployment). Is there any reason you use x-volumes in this example for anchored element?

ndeloof avatar Jan 08 '22 18:01 ndeloof

Why does compose config remove the top level x- but not the nested x- fields? Inconsistent. If compose care about sub top level extensions it should obliviously also keep the top level, correct?

The reason why I used x-volumes was to keep volumes definitions together in one place for visibility.

hholst80 avatar Mar 06 '22 12:03 hholst80

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 21 '22 10:09 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Nov 02 '22 03:11 stale[bot]