伯克依赖厨房ci

时间:2018-01-18 12:00:40

标签: docker continuous-integration chef test-kitchen berksfile

我无法弄清楚我的食谱是否与厨房ci正确运行。这就是我编写和执行的内容:

kitchen.yml

driver:
  name: docker
  binary: docker
  use_sudo: false

provisioner:
  name: chef_zero
  always_update_cookbooks: true
  chef_repo_path: ../..
  nodes: ../../nodes

platforms:
  - name: ubuntu-16.04
    driver_plugin: docker

suites:
  - name: default
    data_bags_path: "../../data_bags"
    encrypted_data_bag_secret_key_path: "../../data_bags/secrets/bitbucket.json"
    run_list:
            - recipe[redmine_test]

verifier:
  name: inspec

我的cookbook文件夹中的Berksfile:

source 'https://supermarket.chef.io'
metadata
cookbook 'nginx', '~> 2.7.6'
cookbook 'logrotate', '~> 1.9.2'

我跑的命令:

$ berks vendor
$ kitchen create && kitchen converge -l debug

This is the error I get:
 ================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb
       ================================================================================

       NoMethodError
       -------------
       undefined method `[]' for nil:NilClass

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:73:in `block in from_file'
         /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:70:in `from_file'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:

        66:      action :add
        67:    end
        68:  end
        69:  
        70:  directory "redmine_repos" do
        71:    path lazy { "#{node['etc']['passwd'][node['redmine']['user']]['dir']}/repos" }
        72:    owner node['redmine']['user']
        73>>   group node['nginx']['group']
        74:    mode 02775
        75:  end
        76:  

我怎么得到这个错误?而组节点['nginx'] ['group']变量在已经出售的nginx食谱中得到很好的定义。

由于

1 个答案:

答案 0 :(得分:0)

create cookbook必须是您的metadata.rb的一部分(nginx)。或者它必须在你的run_list上。

此外,depends nginx已经很久了,已经有2.7.6了。