-
Notifications
You must be signed in to change notification settings - Fork 132
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
stack liquid templating makes a man drink: IF branch or ELSE branch doesn't get executed #1890
Comments
@kke ? |
So this always results in:
|
Both of them seem to have the port 8086? :) |
... that wasn't the point: they don't get mapped. edited it now. |
Have you tried ports:
# {% if lb_service %}
- 1234:8086
# {% else %}
- 4567:8086
# {% endif %} ? |
Odd, with stack: matti/influxdb
version: 0.0.1
description: base
expose: api
variables:
image:
label: image
type: string
default: influxdb:1.2-alpine
from:
prompt:
env: image
to:
env: image
errors: {}
value: influxdb:1.2-alpine
affinity:
label: affinity
type: string
default: label!=no-influxdb
from:
prompt:
env: affinity
to:
env: affinity
errors: {}
value: label!=no-influxdb
lb_service:
label: lb_service
type: string
from:
service_link:
prompt: Pick a loadbalancer
image: kontena/lb
env: lb_service
to:
env: lb_service
required: false
errors: {}
value:
lb_domain:
label: lb_domain
type: string
default: influxdb.example.net
from:
prompt:
env: lb_domain
to:
env: lb_domain
only_if: lb_service
errors: {}
value:
lb_https_redirect:
label: lb_https_redirect
type: boolean
from:
prompt:
env: lb_https_redirect
to:
env: lb_https_redirect
only_if: lb_service
errors: {}
value:
STACK:
label: STACK
type: string
from:
env: STACK
to:
env: STACK
errors: {}
value: influxdb
GRID:
label: GRID
type: string
from:
env: GRID
to:
env: GRID
errors: {}
value: development
services:
api:
image: influxdb:1.2-alpine
affinity:
- label!=no-influxdb
stateful: true
deploy:
strategy: ha
wait_for_port: 8086
interval: 1d
volumes:
- "/var/lib/influxdb"
environment:
links: |
yes. and also verified that this "works" aka port can be mapped:
|
With #1884 that case raises an error:
I assume what's happening is that the optional The optional variables should be defined as |
while at it also fix #1888 for double 🍻 rewards |
same bug here?
|
The current CLI stacks YAML reader uses `Liquid::Template.render(..., strict_variables: true)`. This means that that any references to undefined variables will omit the tag from the output and push an error message into `template.errors`. The CLI ignores those errors, which cascades into other difficult to debug issues when parts are missing from the resulting YAML: * #1846 * #1890 A Liquid bug also means that optional `required: false` stack variables also behave as undefined variables: Shopify/liquid#749 This PR fixes the CLI stack YAML reader to: * Workaround Liquid bugs to treat optional `required: false` stack variables as falsey values for Liquid conditional blocks * Fail `kontena stack ...` fast with a `Liquid error: undefined variable ... ` message if the YAML contains invalid variable references. These errors would be nicer if they also contained the source YAML `file:line`, but that is missing from the `Liquid::UndefinedVariable` error...
Fixed in #1884 - seems I left the magic out of the commit message |
See this one from
below:
The text was updated successfully, but these errors were encountered: