Closed anna-geller closed 35 minutes ago
it might be a separate issue, but I noticed that even when selecting SaaS applications in the first option and explicitly marking all other inputs as required: false
, Kestra still tries to render other inputs e.g. select Slack + GitHub and hit Execute and you will see the error:
At cloud_vms: Cannot render 'expression'. Cause: Unable to find inputs
used in the expression {{ kv('cloud_vms')[inputs.cloud_provider] }}
at line 1
@anna-geller this should be mostly resolved, but there is a new issue with :
- id: cloud_vms
type: io.kestra.plugin.core.kv.Set
key: "{{ task.id }}"
kvType: JSON
value: |
{
"AWS": ["t2.micro", "t2.small", "t2.medium", "t2.large"],
"GCP": ["f1-micro", "g1-small", "n1-standard-1", "n1-standard-2"],
"Azure": ["Standard_B1s", "Standard_B1ms", "Standard_B2s", "Standard_B2ms"]
}
In the KV the entry is stored as a STRING not a JSON.
nope, I can't reproduce on develop, seems to work perfectly fine as JSON, can you repull and try again?
id: myflow
namespace: company.team
tasks:
- id: cloud_vms
type: io.kestra.plugin.core.kv.Set
key: "{{ task.id }}"
kvType: JSON
value: |
{
"AWS": ["t2.micro", "t2.small", "t2.medium", "t2.large"],
"GCP": ["f1-micro", "g1-small", "n1-standard-1", "n1-standard-2"],
"Azure": ["Standard_B1s", "Standard_B1ms", "Standard_B2s", "Standard_B2ms"]
}
You're right, it works better after rebasing!
Also, there is an issue with the input region
in your example.
Bellow is the pebble expression that should work, but it's not as trivial as expected.
- id: region
displayName: Cloud Region
type: SELECT
description: The expression below provides alternative to storing the regions in KV store JSON with cloud provider as key and a list of regions as value
expression: |-
{% if inputs.cloud_provider == 'AWS' %}
{{- ["us-east-1", "us-west-1", "us-west-2", "eu-west-1"] -}}
{% elseif inputs.cloud_provider == 'GCP' %}
{{- ["us-central1", "us-east1", "us-west1", "europe-west1"] -}}
{% else %}
{{- ["eastus", "westus", "centralus", "northcentralus"] -}}
{% endif %}
However, we have an internal error thrown by our pebble renderer that prevent it to be rendered properly as an array :Tried to add ArrayList<String> to java.lang.String
.
As far as I understand, pebble want to output a first empty character somewhere for that following expression.
A hack seems possible to get around this error, but I don't know what the consequences might be for other plugins.
For the moment, I would recommand to not make any modification on the pebble rendering for solving that. For such use-case, an alternative, could be to define one region
input for each provider. We should use the cooldown period to enhance our pebble support with expression returning strong typed object.
all good, we can recommend sticking to KV pairs for this, that pebble example is not the prettiest anyway 👍
this example is now fully working on develop, closing the issue
Describe the issue
Demo of the issue: https://share.descript.com/view/zoM6oaqnBB2
To reproduce create KV:
Then, run the large flow:
Environment