Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.09] backport fix substitution with non-empty env-var #1394

Merged
merged 1 commit into from
Sep 26, 2018

Commits on Sep 26, 2018

  1. Fix substitution with non-empty env-var

    Due to a typo, substitution would not work if the given
    environment-variable was set.
    
    Given the following docker compose file;
    
    ```yaml
    version: "3.7"
    
    services:
      app:
        image: nginx:${version:-latest}
    ```
    
    Deploying a stack with `$version` set would ignore the `$version`
    environment variable, and use the default value instead;
    
    ```bash
    version=alpine docker stack deploy -c docker-compose.yml foobar
    
    Creating network foobar_default
    Creating service foobar_app
    
    docker service ls
    
    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    rskkjxe6sm0w        foobar_app          replicated          1/1                 nginx:latest
    ```
    
    This patch also fixes "soft default" not detecting empty environment variables,
    only non-set environment variables.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    (cherry picked from commit ec3daea)
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Sep 26, 2018
    Configuration menu
    Copy the full SHA
    b8702b8 View commit details
    Browse the repository at this point in the history