diff --git a/modules/jenkins/files/slave_scripts/check_projects_yaml_alphabetized.sh b/modules/jenkins/files/slave_scripts/check_projects_yaml_alphabetized.sh new file mode 100755 index 0000000000..45fdea804c --- /dev/null +++ b/modules/jenkins/files/slave_scripts/check_projects_yaml_alphabetized.sh @@ -0,0 +1,27 @@ +#!/bin/bash -xe + +# It checks that projects.yaml alphabetized and prints list of projects that +# should be sorted. + +export TMPDIR=`/bin/mktemp -d` +trap "rm -rf $TMPDIR" EXIT + +pushd $TMPDIR + +sed -e '/^- project: /!d' -e 's/^- project: //' \ + modules/openstack_project/templates/review.projects.yaml.erb \ + > projects_list + +LC_ALL=C sort projects_list -o projects_list.sorted + +diff projects_list projects_list.sorted > projects_list.diff + +if [[ -n `cat projects_list.diff` ]]; then + echo "The following projects should be alphabetized: " + cat projects_list.diff | grep -e '> ' + exit 1 +else + echo "Projects alphabetized." +fi + +popd diff --git a/modules/openstack_project/files/jenkins_job_builder/config/infra.yaml b/modules/openstack_project/files/jenkins_job_builder/config/infra.yaml index 1da2306d22..c44b6062dd 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/infra.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/infra.yaml @@ -58,3 +58,16 @@ publishers: - console-log - upload-sphinx-draft + + +- job: + name: check-projects-yaml-alphabetized + node: bare-precise + + builders: + - gerrit-git-prep + - shell: | + /usr/local/jenkins/slave_scripts/check_projects_yaml_alphabetized.sh + + publishers: + - console-log diff --git a/modules/openstack_project/files/zuul/layout.yaml b/modules/openstack_project/files/zuul/layout.yaml index 270d34a853..e3053d7d49 100644 --- a/modules/openstack_project/files/zuul/layout.yaml +++ b/modules/openstack_project/files/zuul/layout.yaml @@ -338,6 +338,8 @@ jobs: voting: false - name: gate-climate-devstack-dsvm voting: false + - name: check-projects-yaml-alphabetized + voting: false # puppet-openstack targets - name: gate-puppet-vswitch-puppet-lint voting: false @@ -546,11 +548,13 @@ projects: - gate-config-puppet-lint - gate-config-puppet-syntax - gate-ci-docs + - check-projects-yaml-alphabetized gate: - gate-config-layout - gate-config-pep8 - gate-config-puppet-lint - gate-config-puppet-syntax + - check-projects-yaml-alphabetized post: - ci-docs