From 8a9fc988119417500db6db6f78b80bfbf4880e6a Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Fri, 4 Mar 2016 15:23:23 -0700 Subject: [PATCH] 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 --- deployment/.gitignore | 1 + deployment/update_modules.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/deployment/.gitignore b/deployment/.gitignore index 3916b5352d..67fc4b8073 100644 --- a/deployment/.gitignore +++ b/deployment/.gitignore @@ -1,5 +1,6 @@ Puppetfile.lock .tmp +puppet/module_versions # add modules being managed via librarian-puppet under here puppet/aodh diff --git a/deployment/update_modules.sh b/deployment/update_modules.sh index 447f2b7fdf..db54d51ce6 100755 --- a/deployment/update_modules.sh +++ b/deployment/update_modules.sh @@ -111,6 +111,7 @@ TIMEOUT=600 export PUPPET_GEM_VERSION=${PUPPET_GEM_VERSION:-'~>3.8'} export BUNDLE_DIR=${BUNDLE_DIR:-'/var/tmp/.bundle_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 cd $DEPLOYMENT_DIR @@ -158,3 +159,14 @@ if [ "$RESET_HARD" = true ]; then done cd $DEPLOYMENT_DIR 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