如何通过詹金斯设置厨师属性? [英] How to set chef attributes via Jenkins?
问题描述
我想运行一组通用的食谱,这些食谱将在我们的实验室中供用户选择我们产品的版本,并希望使用jenkins来完成. Jenkins作业在节点引导期间传递此信息的最佳方法是什么?是通过-j选项,例如-j'{"load_version":"$ LOAD_VERSION"}',其中$ LOAD_VERSION是Jenins作业的参数,有几种选择?
I want to run a set of generic cookbooks that will a user-selected version of our product in our lab, and want to use jenkins to do this. What is the best way for my Jenkins job to pass this information during the node bootstrap? Is it via the -j option, for example -j '{"load_version" : "$LOAD_VERSION"}', where $LOAD_VERSION is a parameter of the Jenins job with several choices?
推荐答案
Yes, -j
will let you supply a JSON blob of attributes to the first chef-client run of your recipes.
通常最好将范围添加到节点属性,因此,如果您扩展内容,则与其他属性发生冲突的可能性较小.
It's generally best to add scope to your node attributes so if you expand things you have less chance of clashing with other attributes.
knife bootstrap <host> -r 'recipe[your_cb::your_recipe]' -j '{ "your_cb": { "load_version": "$LOAD_VERSION" } }'
这篇关于如何通过詹金斯设置厨师属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!