Is there any way to reference names within pubspec.yaml? - flutter

Is there any way to reference a predefined name in pubspec.yaml?
I am trying to reference the "name" key's value in a structure used by a plugin
name: tpoly
description: A new Flutter application.
# [...]
flutter_launcher_name:
name: *name
At the end the plugin should receive (basically the value should get substituted),
flutter_launcher_name:
name: tpoly

First declare the variable using &. Here, foo, for example:
name: &foo tpoly
To refer, use *.
flutter_launcher_name:
name: *foo

Related

How to use !ImportValue to get the resource arn using AWS SAM template

I have a base template, output section is like this:
Outputs:
layerName:
Value: !Ref Psycopg2LayerLambdaLayer
How to get the arn of Psycopg2LayerLambdaLayer using the output from the base template in my new template? is this correct?
Layers: !ImportValue layerName.arn
If you want to use an Output value as an Import in a different template, you must export it first. In your example, it might look like the following:
Outputs:
layerArn:
Value: !GetAtt Psycopg2LayerLambdaLayer.arn
Export:
Name: psycopg2LayerArn
After deploying this, you can import the value in another stack with !ImportValue psycopg2LayerArn.
Note that an export has to have a unique name per account and region, therefore it is a good idea to prefix it with the stack/resource name. Also note that you can’t export objects, only scalar values such as strings.
Read more at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html

Conditional expression in withParam of argo workflow template spec

Is it possible to specify a conditional expression in the withParam of a template step? For example, I have a very typical parallelization case that works fine:
#...
templates:
- name: my-template
steps:
- - name: make-list
template: makes-a-list
- - name: consume-list
template: process-list-element
arguments:
parameters:
- name: param-name
value: "{{item}}"
withParam: "{{steps.make-list.outputs.result}}"
What I'd like to do is be able to have consume-list use a different list of "items" to process in parallel, if specified. I've tried several variations of this:
withParam: "{{= workflow.parameters.use-this-list == '' ? steps.make-list.outputs.result : workflow.parameters.use-this-list }}"
where workflow-level parameter use-this-list can be given as a JSON list (e.g., '["item1","item2"]') or an empty string, in which case I'd like the template to use the output of the make-list step.
I've tried that conditional expression many different ways -- using different quotations, using toJson around different parts of it, etc. -- but argo never seems to be able to understand it.
Is it possible to do something like this? FWIW I haven't found any examples anywhere that attempt this sort of thing.

Why YAML Schema (from JSON Schema) is returning $ref x in schema can not be resolved?

I have this schema file in ./types/index.yaml:
$schema: "https://json-schema.org/draft/2020-12/schema"
name: Types in YAML
definitions:
flow:
type: object
properties:
slug:
type: string
flow_list:
type: 'array'
items:
$ref: "#/definitions/flow"
And I have this "instance" YAML file, in contents/en.yaml:
# yaml-language-server: $schema=../types/index.yaml#definitions/flow_list
-
slug: '123'
I would expect it to allow me to create a list of objects with the slug property on it (to get started), but instead I am getting something like this (with the ...... filled in with the full absolute OS path):
$ref 'definitions/flow_list' in 'file:///...../types/index.yaml' can not be resolved.
I am using the RedHat VSCode YAML extension. Any ideas on how to get it so I can write the array of "flows" here?
Restarting VSCode a few times seemed to fix it.

Parameter name containing special characters on Helm chart

In my Helm chart, I need to set the following Java Spring parameter name:
company.sms.security.password#id(name):
secret:
name: mypasswd
key: mysecretkey
But when applying the template, I encounter a syntax issue.
oc apply -f template.yml
The Deployment "template" is invalid: spec.template.spec.containers[0].env[79].name: Invalid value: "company.sms.security.password#id(name)": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')
What I would usually do is defining this variable at runtime like this:
JAVA_TOOL_OPTIONS:
-Dcompany.sms.security.password#id(name)=mypass
But since it's storing sensitive data, obviously I cannot log in clear the password.
So far I could only think about defining an Initcontainer as a workaround, changing the parameter name is not an option.
Edit: So the goal is to not log the password neither in the manifest nor in the application logs.
Edited:
Assign the value from your secret to one environment variable, and use it in the JAVA_TOOL_OPTIONS environment variable value. the way to expand the value of a previously defined variable VAR_NAME, is $(VAR_NAME).
For example:
- name: MY_PASSWORD
valueFrom:
secretKeyRef:
name: mypasswd
key: mysecretkey
- name: JAVA_TOOL_OPTIONS
value: "-Dcompany.sms.security.password#id(name)=$(MY_PASSWORD)"
Constrains
There are some conditions for kuberenetes in order to parse the $(VAR_NAME) correctly, otherwise $(VAR_NAME) will be parsed as a regular string:
The variable VAR_NAME should be defined before the one that uses it
The value of VAR_NAME must not be another variable, and must be defined.
If the value of VAR_NAME consists of other variables or is undefined, $(VAR_NAME) will be parsed as a string.
In the example above, if the secret mypasswd in the pod's namespace doesn't have a value for the key mysecretkey, $(MY_PASSWORD) will appear literally as a string and will not be parsed.
References:
Dependent environment variables
Use secret data in environment variables

How to include default value with tpl function call

I have top level chart and one of the subcharts. In subchart I want to use variables that defined in level chart, and if it is not found - use default value.
I have code like this in one of deployment definitions in my subchart
name: {{tpl .Values.global.my.GlobalValue .}}
where Values.global.my.GlobalValue - is parameter from top level chart.
Problem is when I try to install only subchart - I am failing, I need some defaults.
I tried to puth like below and it is not working
name: {{default defaultName tpl .Values.global.my.GlobalValue .}}
name: {{tpl .Values.global.my.GlobalValue . | defaultName}}
Could you please advise the correct way to do that.
As per Using the default function:
One function frequently used in templates is the default function:
default DEFAULT_VALUE GIVEN_VALUE. This function allows you to specify
a default value inside of the template, in case the value is omitted.
You should use:
name: {{ .Values.global.my.GlobalValue | default "defaultName" | quote }}