diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst index 6e83b49e22..289d9b18d0 100644 --- a/doc/source/gerrit.rst +++ b/doc/source/gerrit.rst @@ -680,7 +680,7 @@ Have Zuul Monitor a Gerrit Project ===================================== Define the required jenkins jobs for this project using the Jenkins Job -Builder. Edit openstack-infra/config:modules/openstack_project/files/jenkins_jobs/config/projects.yaml +Builder. Edit openstack-infra/config:modules/openstack_project/files/jenkins_job_builder/config/projects.yaml and add the desired jobs. Most projects will use the python jobs template. A minimum config:: diff --git a/modules/openstack_project/files/jenkins_job_builder/config/chef-cookbooks-jobs.yaml b/modules/openstack_project/files/jenkins_job_builder/config/chef-cookbooks-jobs.yaml new file mode 100644 index 0000000000..84db2fbbb3 --- /dev/null +++ b/modules/openstack_project/files/jenkins_job_builder/config/chef-cookbooks-jobs.yaml @@ -0,0 +1,29 @@ +- job-template: + name: 'gate-{name}-chef-unit' + node: '{node}' + + triggers: + - zuul + + builders: + - gerrit-git-prep + - chef-cookbook-prep + - chef-cookbook-rspec + + publishers: + - console-log + +- job-template: + name: 'gate-{name}-chef-lint' + node: '{node}' + + triggers: + - zuul + + builders: + - gerrit-git-prep + - chef-cookbook-prep + - chef-cookbook-lint + + publishers: + - console-log diff --git a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml index 082000a9d8..098efba37f 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml @@ -76,6 +76,29 @@ erb -x -T '-' $f | ruby -c done +- builder: + name: chef-cookbook-prep + builders: + - shell: | + mkdir -p .cookbooks .bundle + bundle install --path=.bundle + bundle exec berks install --path=.cookbooks + export COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\') + if [ -z $COOKBOOK ]; then + echo "Cookbook name not defined in metadata.rb" + exit 1 + fi + +- builder: + name: chef-cookbook-lint + builders: + - shell: "bundle exec foodcritic -f any -t ~FC003 -t ~FC023 .cookbooks/$COOKBOOK" + +- builder: + name: chef-cookbook-rspec + builders: + - shell: "bundle exec rspec .cookbooks/$COOKBOOK" + - builder: name: selenium builders: diff --git a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml index 947f1dbb84..c3bf535c80 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml @@ -879,3 +879,12 @@ jobs: - python-jobs + +- project: + name: cookbook-openstack-common + github-org: stackforge + node: quantal + + jobs: + - gate-{name}-chef-lint + - gate-{name}-chef-unit diff --git a/modules/openstack_project/files/zuul/layout.yaml b/modules/openstack_project/files/zuul/layout.yaml index c2f941f687..33e47fcfb6 100644 --- a/modules/openstack_project/files/zuul/layout.yaml +++ b/modules/openstack_project/files/zuul/layout.yaml @@ -1668,9 +1668,11 @@ projects: - name: stackforge/cookbook-openstack-common check: - - gate-noop + - gate-cookbook-openstack-common-chef-lint + - gate-cookbook-openstack-common-chef-unit gate: - - gate-noop + - gate-cookbook-openstack-common-chef-lint + - gate-cookbook-openstack-common-chef-unit - name: stackforge/cookbook-openstack-compute check: