SLN*_*SLN 2 yaml azure-devops azure-pipelines
我有一个如下所示的environment.yml,我想读出名称变量(core-force)的内容并将其设置为我的azure-pipeline.yamal文件中的全局变量的值,我该怎么做?
name: core-force
channels:
- conda-forge
dependencies:
- click
- Sphinx
- sphinx_rtd_theme
- numpy
- pylint
- azure-cosmos
- python=3
- flask
- pytest
- shapely
Run Code Online (Sandbox Code Playgroud)
在我的 azure-pipeline.yml 文件中我想要类似的东西
variables:
tag: get the value of the name from the environment.yml aka 'core-force'
Run Code Online (Sandbox Code Playgroud)
请检查这个例子:
文件:vars.yml
variables:
favoriteVeggie: 'brussels sprouts'
Run Code Online (Sandbox Code Playgroud)
文件:azure-pipelines.yml
variables:
- template: vars.yml # Template reference
steps:
- script: echo My favorite vegetable is ${{ variables.favoriteVeggie }}.
Run Code Online (Sandbox Code Playgroud)
请注意,变量是简单的字符串,如果您想使用列表,您可能需要在 powershell 中在您想要使用该列表中的值的地方进行一些工作。
如果您不想使用上面所示的模板功能,您需要执行以下操作:
environment.yml
文件并设置变量我在开发者社区中找到了这个主题,您可以在其中阅读:
Yaml 变量始终是 string: string 映射。该文档目前看来是正确的,尽管您上次访问时我们可能遇到了错误。
我们准备在不久的将来发布一个功能,让您可以通过更复杂的结构。敬请关注!
但我没有这方面的更多信息。
归档时间: |
|
查看次数: |
8456 次 |
最近记录: |