Use Chef Delivery to run verification tests

Chef Delivery is the command-line interface for workflow capabilities in Chef
Automate and the standard interface that Chef community cookbooks use for
verification.

Change-Id: I72a1775369f955901260173b061f28640055c808
Implements: blueprint deprecate-rakefiles
This commit is contained in:
Samuel Cassiba 2018-07-11 23:14:03 -07:00
parent 780c0d06e9
commit d37238a2d1
4 changed files with 29 additions and 5 deletions

9
.delivery/project.toml Normal file
View File

@ -0,0 +1,9 @@
[local_phases]
unit = 'berks vendor cookbooks'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "./scripts/json_check.sh"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -1,10 +1,10 @@
- job:
name: openstack-chef-repo-rake
name: openstack-chef-repo-delivery
parent: base
description: Run rake tests with openstack-chef-repo
description: Run Chef Delivery tests with openstack-chef-repo
required-projects: openstack/openstack-chef-repo
pre-run: playbooks/pre.yaml
run: playbooks/rake.yaml
run: playbooks/delivery.yaml
timeout: 2700
- job:
@ -21,11 +21,11 @@
name: openstack-chef-repo-jobs
check:
jobs:
- openstack-chef-repo-rake
- openstack-chef-repo-delivery
- openstack-chef-repo-integration
gate:
jobs:
- openstack-chef-repo-rake
- openstack-chef-repo-delivery
- openstack-chef-repo-integration
- project:

8
playbooks/delivery.yaml Normal file
View File

@ -0,0 +1,8 @@
- hosts: all
roles:
- revoke-sudo
tasks:
- name: run delivery local
shell:
cmd: chef exec delivery local all
chdir: '{{ zuul.project.src_dir }}'

7
scripts/json_check.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# check data bags, roles, environment files sanity by loading them in
# chef-zero
for db in $(ls -d data_bags/* | cut -f2 -d'/');do knife data bag from file $db data_bags/$db/*.json -z --secret-file .chef/encrypted_data_bag_secret;done
for role in $(ls roles | grep json);do knife role from file $role -z;done
for env in $(ls environments | grep json);do knife environment from file $env -z ;done