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

Misleading interpolation of a template variable with an empty string #808

Open
johnbizokk opened this issue Sep 11, 2020 · 0 comments
Open

Comments

@johnbizokk
Copy link

Description

By default, the most common way (from my perspective) is to set some default values for the keys specified in the parameters file, which is in the root of the *.dockerapp directory. And when we want to add the environment, we copy the default file, modify some settings and finally - apply the new parameters file during the application render process. Unfortunately, I have discovered that we cannot override the value with the empty string when we have the non-empty default value for the specific key. This rendering behavior leads to additional debugging. The only way to have the empty value - is to keep the empty string value in the default parameters file for the individual key and add the default value as a comment down below.

I also attached the non-working examples - see the Annex №1, 2, 3, 4 below.

Steps to reproduce the issue:

  1. Have the docker-compose.yml file with the following content - see the Annex №1 below.
  2. Have the metadata.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. Have the parameters.override.yml file with the following content - see the Annex №4 below.
  5. Execute the following render command - docker app render --parameters-file parameters.override.yml.

Describe the results you received:

The Docker App retains the default non-empty string value instead of replacing it with the empty string value.

Describe the results you expected:

We expect the proper overriding.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:43:18 2020
 OS/Arch:           windows/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker app version:

Version:               v0.8.0
Git commit:            7eea32b7
Built:                 Mon Jun 22 16:00:36 2020
OS/Arch:               windows/amd64
Experimental:          off
Renderers:             none
Invocation Base Image: docker/cnab-app-base:v0.8.0

Output of docker info:

Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0)
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)
  mutagen: Synchronize files with Docker Desktop (Docker Inc., testing)
Server:
 Containers: X
  Running: X
  Paused: X
  Stopped: X
 Images: X
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  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: X
  Is Manager: true
  ClusterID: X
  Managers: X
  Nodes: X
  Default Address Pool: X
  SubnetSize: X
  Data Path Port: X
  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: X
  Manager Addresses:
   X:X
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.104-microsoft-standard
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: X
 Total Memory: X.XGiB
 Name: docker-desktop
 ID: X
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 54
  Goroutines: 167
  System Time: X
  EventsListeners: 2
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Annex №1 (docker-compose.yml)

version: '3.7'
services:
  application:
    x-enabled: "${enable-application}"
    image: "image"
    labels:
      com.example.label-with-empty-value: "${labels.label-with-empty-value}"

Annex №2 (metadata.yml)

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

Annex №3 (parameters.yml)

enable-application: true
labels:
  label-with-empty-value: "non-empty"

Annex №4 (parameters.override.yml)

enable-application: true
labels:
  label-with-empty-value: ""
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant