From cf7c5bddcf9496aedf38a586a5494df4a129b640 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Mon, 26 May 2014 11:16:14 +0200 Subject: [PATCH] Use strainer for chef checks when possible This way, we get a per-cookbook possibility to set test-specific options. For example, a certain cookbook might want to be more or less strict with foodcritic and could then handle that from the cookbooks Strainerfile. In addition to that, its is transparent for cookbook contributors to figure out what test get run by jenkins. Change-Id: I0353b8207abb116ea3849c04df39546f8c2625db --- .../jenkins_job_builder/config/macros.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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 d97f282532..80c3f11fe6 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml @@ -136,20 +136,32 @@ builders: - shell: | COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\') - ruby1.9.1 /usr/bin/bundle exec rubocop + if grep rubocop: Strainerfile; then + ruby1.9.1 /usr/bin/bundle exec strainer test -o rubocop + else + ruby1.9.1 /usr/bin/bundle exec ruby1.9.1 /usr/bin/bundle exec rubocop + fi - builder: name: chef-cookbook-foodcritic builders: - shell: | - ruby1.9.1 /usr/bin/bundle exec foodcritic -f any -t ~FC003 -t ~FC023 . + if grep foodcritic: Strainerfile; then + ruby1.9.1 /usr/bin/bundle exec strainer test -o foodcritic + else + ruby1.9.1 /usr/bin/bundle exec foodcritic -f any -t ~FC003 -t ~FC023 . + fi - builder: name: chef-cookbook-chefspec builders: - shell: | COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\') - ruby1.9.1 /usr/bin/bundle exec rspec .cookbooks/$COOKBOOK/spec + if grep chefspec: Strainerfile; then + ruby1.9.1 /usr/bin/bundle exec strainer test -o chefspec + else + ruby1.9.1 /usr/bin/bundle exec rspec .cookbooks/$COOKBOOK/spec + fi - builder: name: run-tests