[英]docker-compose.yml problem with directives in file
What does this mean in docker-compose.yml directive?这在 docker-compose.yml 指令中是什么意思?
${{ variable }}
And how is it used?它是如何使用的?
In a pipeline, template expression variables (${{ variables.var }}) get processed at compile time, before runtime starts.在管道中,模板表达式变量 (${{ variables.var }}) 在运行时开始之前在编译时得到处理。 Macro syntax variables ($(var)) get processed during runtime before a task runs.宏语法变量 ($(var)) 在运行时在任务运行之前得到处理。 Runtime expressions ($[variables.var]) also get processed during runtime but were designed for use with conditions and expressions.运行时表达式 ($[variables.var]) 也在运行时得到处理,但设计用于条件和表达式。 When you use a runtime expression, it must take up the entire right side of a definition.当您使用运行时表达式时,它必须占据定义的整个右侧。
In the following example, you can see that the template expression still has the initial value of the variable after the variable is updated.在下面的示例中,您可以看到模板表达式在变量更新后仍然具有变量的初始值。 The value of the macro syntax variable updates.宏语法变量的值更新。 The template expression value does not change because all template expression variables get processed at compile time before tasks run.模板表达式值不会更改,因为所有模板表达式变量都在编译时在任务运行之前得到处理。 In contrast, macro syntax variables are evaluated before each task runs.相反,宏语法变量在每个任务运行之前进行评估。
variables:
- name: one
value: initialValue
steps:
- script: |
echo ${{ variables.one }} # outputs initialValue
echo $(one)
displayName: First variable pass
- bash: echo "##vso[task.setvariable variable=one]secondValue"
displayName: Set new variable value
- script: |
echo ${{ variables.one }} # outputs initialValue
echo $(one) # outputs secondValue
displayName: Second variable pass
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.