Capture module versions when built

This change adds a module_versions file that contains the versions of
the modules that were pulled down when update_modules.sh was run. We
need this to be able to reproduce the git modules since we are removing
the .git folders from the modules when they get packaged.

Change-Id: I6564bcb8c46343e1f11d4f0dac60a2c2646ada17
Closes-Bug: #1553385
This commit is contained in:
Alex Schultz 2016-03-04 15:23:23 -07:00
parent 8804e54397
commit 8a9fc98811
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Puppetfile.lock Puppetfile.lock
.tmp .tmp
puppet/module_versions
# add modules being managed via librarian-puppet under here # add modules being managed via librarian-puppet under here
puppet/aodh puppet/aodh

View File

@ -111,6 +111,7 @@ TIMEOUT=600
export PUPPET_GEM_VERSION=${PUPPET_GEM_VERSION:-'~>3.8'} export PUPPET_GEM_VERSION=${PUPPET_GEM_VERSION:-'~>3.8'}
export BUNDLE_DIR=${BUNDLE_DIR:-'/var/tmp/.bundle_home'} export BUNDLE_DIR=${BUNDLE_DIR:-'/var/tmp/.bundle_home'}
export GEM_HOME=${GEM_HOME:-'/var/tmp/.gem_home'} export GEM_HOME=${GEM_HOME:-'/var/tmp/.gem_home'}
MODULE_VERSIONS_FILE="${DEPLOYMENT_DIR}/puppet/module_versions"
# We need to be in the deployment directory to run librarian-puppet-simple # We need to be in the deployment directory to run librarian-puppet-simple
cd $DEPLOYMENT_DIR cd $DEPLOYMENT_DIR
@ -158,3 +159,14 @@ if [ "$RESET_HARD" = true ]; then
done done
cd $DEPLOYMENT_DIR cd $DEPLOYMENT_DIR
fi fi
echo "MODULE LIST" > $MODULE_VERSIONS_FILE
for MOD in $(grep "^mod" Puppetfile | tr -d '[:punct:]' | awk '{ print $2 }'); do
MOD_DIR="${DEPLOYMENT_DIR}/puppet/${MOD}"
if [ -d $MOD_DIR ] && [ -d "${MOD_DIR}/.git" ];
then
echo "${MOD}: $(git --git-dir ${MOD_DIR}/.git rev-parse HEAD)" >> $MODULE_VERSIONS_FILE
fi
done
cat $MODULE_VERSIONS_FILE