From 5c1dacbd814530be17d0956318a63201e08ed4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Mon, 5 Aug 2013 18:50:25 -0400 Subject: [PATCH] Fix puppet-lint for bare puppet modules puppet-lint expands symbolic links and use the realpath when checking for the location of manifests. This means the autoloader_layout check still fail although we tried to force the correct folder name by using a symbolic link named after the puppet module. This change brings two changes. It now copies all files to a new folder named after the puppet module. Rsync is used for the copy process. The destination folder is excluded and so are hidden folders such as .git. It also uses an alternative method to determine the module name by reading the 'name' field from the Modulefile. This allows a puppet module repository or project to be renamed without breaking puppet-lint. An example of such use case would be a rename of puppet-quantum to puppet-neutron. If the Modulefile is not found or the name cannot be determined, the puppet-lint builder falls back to its default behavior which consists of running puppet-lint in the root of the workspace. Change-Id: I6158ab3b32499820b7d09db7b31d4226650af8ae --- .../files/jenkins_job_builder/config/macros.yaml | 14 ++++++++++---- .../config/puppet-module-jobs.yaml | 3 +-- 2 files changed, 11 insertions(+), 6 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 2b24464e2b..2e658855e4 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml @@ -66,10 +66,16 @@ name: puppet-lint builders: - shell: | - test -d modules || {{ - ln -s . {project} - cd {project} - }} + if [ -f Modulefile ]; then + MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\') + if [ -z "$MODULE" ]; then + echo "Module name not defined in Modulefile" + else + mkdir -p "$MODULE" + rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE" + cd "$MODULE" + fi + fi rake lint - builder: diff --git a/modules/openstack_project/files/jenkins_job_builder/config/puppet-module-jobs.yaml b/modules/openstack_project/files/jenkins_job_builder/config/puppet-module-jobs.yaml index b14d177b3a..e91c993356 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/puppet-module-jobs.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/puppet-module-jobs.yaml @@ -20,8 +20,7 @@ builders: - gerrit-git-prep - - puppet-lint: - project: '{name}' + - puppet-lint publishers: - console-log