docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 177 forks source link

docker-app init wrongly extracts placeholders with dots #484

Closed dschulten closed 5 years ago

dschulten commented 5 years ago

Description

docker-app init creates a settings.yml (or parameters.yml lately) where it extracts placeholders from the given docker-compose.yml.

Placeholders with dots like ${versions.prometheus} or ${versions.alertmanager} are extracted as-is.

Steps to reproduce the issue:

  1. Create docker-compose.yml:
    
    version: '3.7'

services: prometheus: image: prom/prometheus:${versions.prometheus:-v2.7.0} ports:

  1. Initialize (assuming the CNAB preview version)
    docker-app init foo
  2. Render
    $ docker-app render

Describe the results you received:

Error: failed to load Compose file: invalid interpolation format for versions.prometheus.image: "required variable versions.prometheus:v2.7.0 is missing a value". You may need to escape any $ with another $.

The reason is that the parameters.yml is structured as a properties file, not a YAML:

versions.prometheus: v2.7.0
versions.alertmanager: v0.15.0

Describe the results you expected: No error while rendering, parameters.yml should look like below:

versions:
    alertmanager: v0.15.0
    prometheus: v2.7.0

Additional information you deem important (e.g. issue happens only occasionally): I know that parameters in image names will no longer be allowed shortly, this is just for illustration.

Also it seems that docker-app init understands the default values so far that it extracts them into the parameters file, but it cannot interpolate them in the docker-compose.yml it creates inside the foo.dockerapp folder.

Output of docker version:

$ docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:47:20 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker-app version:

$ docker-app-cnab version
Version:      v0.7.3
Git commit:   332efaa
Built:        Fri Nov 30 15:17:53 2018
OS/Arch:      linux/amd64
Experimental: off
Renderers:    none
silvin-lubecki commented 5 years ago

Fixed with #486

silvin-lubecki commented 5 years ago

@dschulten by the way I have to warn ⚠️ you that you won't be able to add parameters to the image field anymore, as discussed here.