How to set chef attributes via Jenkins?

◇◆丶佛笑我妖孽 提交于 2020-01-06 15:59:28

问题


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?


回答1:


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" } }'


来源:https://stackoverflow.com/questions/25750087/how-to-set-chef-attributes-via-jenkins

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!