Merge "bug fix: bad path on auto generated documentation"
[releng.git] / prototypes / xci / scripts / update-osa-version-files.sh
old mode 100644 (file)
new mode 100755 (executable)
index 92df978..d822d25
@@ -9,7 +9,8 @@
 ##############################################################################
 
 # This script is used to pin the SHAs for the various roles in the
-# ansible-role-requirements file
+# ansible-role-requirements file. It will also update the SHAs for
+# OSA and bifrost.
 
 set -e
 
@@ -18,7 +19,7 @@ releng_xci_base="$(dirname $(readlink -f $0))/.."
 
 usage() {
     echo """
-    ${0} <openstack-ansible commit SHA>
+    ${0} <openstack-ansible commit SHA> [<bifrost commit SHA>]
     """
     exit 0
 }
@@ -32,7 +33,7 @@ printme() {
 }
 
 # Only need a single argument
-[[ $# -ne 1 ]] && echo "Invalid number of arguments!" && usage
+[[ $# -lt 1 || $# -gt 2 ]] && echo "Invalid number of arguments!" && usage
 
 tempdir="$(mktemp -d)"
 
@@ -52,7 +53,7 @@ popd &> /dev/null
 pushd $tempdir/openstack-ansible &> /dev/null
 source scripts/sources-branch-updater-lib.sh
 printme "Synchronize roles and packages"
-update_ansible_role_requirements "master" "false" "true"
+update_ansible_role_requirements "master" "true" "true"
 
 # Construct the ansible-role-requirements-file
 echo """---
@@ -65,12 +66,17 @@ echo """---
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 # these versions are extracted based on the osa commit ${1} on $(git --no-pager log -1 --format=%cI $1)
-# https://review.openstack.org/gitweb?p=openstack/openstack-ansible.git;a=commit;h=$1
-""" > $releng_xci_base/file/ansible-role-requirements.yml
+# https://review.openstack.org/gitweb?p=openstack/openstack-ansible.git;a=commit;h=$1""" > $releng_xci_base/file/ansible-role-requirements.yml
 cat $tempdir/openstack-ansible/ansible-role-requirements.yml >> $releng_xci_base/file/ansible-role-requirements.yml
 
 # Update the pinned OSA version
-sed -i "/^export OPENSTACK_OSA_VERSION/s@:-\"[a-z0-9]*@:-\"${1}@" $releng_xci_base/config/pinned-versions
+sed -i -e "/^export OPENSTACK_OSA_VERSION/s@:-\"[a-z0-9]*@:-\"${1}@" \
+    -e "s/\(^# HEAD of osa.*of \).*/\1$(date +%d\.%m\.%Y)/" $releng_xci_base/config/pinned-versions
+
+# Update the pinned bifrost version
+[[ -n ${2:-} ]] && \
+    sed -i -e "/^export OPENSTACK_BIFROST_VERSION/s@:-\"[a-z0-9]*@:-\"${2}@" \
+    -e "s/\(^# HEAD of bifrost.*of \).*/\1$(date +%d\.%m\.%Y)/" $releng_xci_base/config/pinned-versions
 
 popd &> /dev/null