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
This commit is contained in:
parent
3f18a111af
commit
5c1dacbd81
@ -66,10 +66,16 @@
|
|||||||
name: puppet-lint
|
name: puppet-lint
|
||||||
builders:
|
builders:
|
||||||
- shell: |
|
- shell: |
|
||||||
test -d modules || {{
|
if [ -f Modulefile ]; then
|
||||||
ln -s . {project}
|
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
|
||||||
cd {project}
|
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
|
rake lint
|
||||||
|
|
||||||
- builder:
|
- builder:
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
builders:
|
builders:
|
||||||
- gerrit-git-prep
|
- gerrit-git-prep
|
||||||
- puppet-lint:
|
- puppet-lint
|
||||||
project: '{name}'
|
|
||||||
|
|
||||||
publishers:
|
publishers:
|
||||||
- console-log
|
- console-log
|
||||||
|
Loading…
Reference in New Issue
Block a user