Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Render error of a variable with the dash symbol and surrounded with the double-quotes #574

Closed
johnbizokk opened this issue Jul 16, 2019 · 2 comments · May be fixed by #587
Closed

Render error of a variable with the dash symbol and surrounded with the double-quotes #574

johnbizokk opened this issue Jul 16, 2019 · 2 comments · May be fixed by #587
Labels

Comments

@johnbizokk
Copy link

Description

When we try to use dash symbol (-) as a part of the variable name (aka. key) and surround the variable with the double-quotes - docker app binary produces a render error. The problem doesn't appear when we do not use the dash symbol in the variable name, or we use a variable name in the docker-compose.yml file without double-quotes.

I also attached the working examples - see the Annex №4,5,6 and Annex №7,8,9 below.

Steps to reproduce the issue:

  1. Have the docker-compose file with the following content - see the Annex №1 below.
  2. Have the parameters.yml file with the following content - see the Annex №2 below.
  3. Have the parameters.yml file with the following content - see the Annex №3 below.
  4. Execute the following render command - docker-app-standalone-linux render.

Describe the results you received:

Unfortunately, we've got the following error:
Error: render failed: Action "com.docker.app.render" failed: failed to load Compose file: invalid interpolation format for x-default-placement.placement.constraints.[]: "required variable constraints.node.labels.operating-system\" is missing a value". You may need to escape any $ with another $.

Describe the results you expected:

We expect from docker app binary to render template correctly.

Output of docker version:

Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        2d0083d
 Built:             Thu Jun 27 17:56:06 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       2d0083d
  Built:            Thu Jun 27 17:26:28 2019
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-app version:

Version:               v0.8.0
Git commit:            7eea32b7
Built:                 Tue Jun 11 20:53:26 2019
OS/Arch:               linux/amd64
Experimental:          off
Renderers:             none
Invocation Base Image: docker/cnab-app-base:v0.8.0

Output of docker info:

Containers: X
 Running: X
 Paused: X
 Stopped: X
Images: X
Server Version: 18.09.7
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: local
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
 NodeID: ID
 Is Manager: true
 ClusterID: ID
 Managers: X
 Nodes: X
 Default Address Pool: 10.0.0.0/8
 SubnetSize: 24
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address:  IPADDR
 Manager Addresses:
 IPADDR
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-957.21.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 55.86GiB
Name: hostname
ID: ID
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 http://localhost:6000/
Live Restore Enabled: false
Product License: Community Engine

Annex №1 (docker-compose.yml) - render error - group №1

version: '3.7'
x-default-placement: &default-placement
  placement:
    constraints:
      - engine.labels.operatingsystem != "$constraints.node.labels.operating-system"
services:
  application:
    x-enabled: "${enable-application}"
    image: "image"

Annex №2 (parameters.yml) - render error - group №1

enable-application: true
constraints:
  node:
    labels:
      operating-system: ubuntu

Annex №3 (metadata.yml) - render error - group №1

version: 1.0.0
name: application
description: "application bundle"
namespace: "namespace"
maintainers:
  - name: Maintainer
    email: "email@mail.com"

Annex №4 (docker-compose.yml) - successful render - group №2

version: '3.7'
x-default-placement: &default-placement
  placement:
    constraints:
      - engine.labels.operatingsystem != $constraints.node.labels.operating-system
services:
  application:
    x-enabled: "${enable-application}"
    image: "image"

Annex №5 (parameters.yml) - successful render - group №2

enable-application: true
constraints:
  node:
    labels:
      operating-system: ubuntu

Annex №6 (metadata.yml) - successful render - group №2

version: 1.0.0
name: application
description: "application bundle"
namespace: "namespace"
maintainers:
  - name: Maintainer
    email: "email@mail.com"

Annex №7 (docker-compose.yml) - successful render - group №3

version: '3.7'
x-default-placement: &default-placement
  placement:
    constraints:
      - engine.labels.operatingsystem != "$constraints.node.labels.operatingsystem"
services:
  application:
    x-enabled: "${enable-application}"
    image: "image"

Annex №8 (parameters.yml) - successful render - group №3

enable-application: true
constraints:
  node:
    labels:
      operatingsystem: ubuntu

Annex №9 (metadata.yml) - successful render - group №3

version: 1.0.0
name: application
description: "application bundle"
namespace: "namespace"
maintainers:
  - name: Maintainer
    email: "email@mail.com"
@silvin-lubecki
Copy link
Contributor

Hello @johnbizokk, thank you for filling this issue 👍

@jcsirot
Copy link
Contributor

jcsirot commented Oct 7, 2019

Hello @johnbizokk
This issue has been fixed in the master branch (#602 and #651). The character - is now unauthorized in the name of variables in the application template. When this character is used in the template, an error message is now printed in the console.
Note that in the Compose file specification the - character is used to specify a default value for a to-be-interpolated variable but in docker app these default values have be set in the parameters.yml file.

@jcsirot jcsirot closed this as completed Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants