2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2017 SUSE LINUX GmbH and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 # This script is used to pin the SHAs for the various roles in the
12 # ansible-role-requirements file. It will also update the SHAs for
17 # NOTE(hwoarang) This could break if files are re-arranged in the future
18 releng_xci_base="$(dirname $(readlink -f $0))/.."
22 ${0} <openstack-ansible commit SHA> [<bifrost commit SHA>]
28 [[ -d $tempdir ]] && rm -rf $tempdir
35 # Only need a single argument
36 [[ $# -lt 1 || $# -gt 2 ]] && echo "Invalid number of arguments!" && usage
38 tempdir="$(mktemp -d)"
42 pushd $tempdir &> /dev/null
44 printme "Downloading the sources-branch-updater-lib.sh library"
46 printme "Cloning the openstack-ansible repository"
48 git clone -q git://git.openstack.org/openstack/openstack-ansible && cd openstack-ansible && git checkout -q $1
53 pushd $tempdir/openstack-ansible &> /dev/null
54 source scripts/sources-branch-updater-lib.sh
55 printme "Synchronize roles and packages"
56 update_ansible_role_requirements "master" "true" "true"
58 # Construct the ansible-role-requirements-file
60 # SPDX-license-identifier: Apache-2.0
61 ##############################################################################
62 # Copyright (c) 2017 Ericsson AB and others.
63 # All rights reserved. This program and the accompanying materials
64 # are made available under the terms of the Apache License, Version 2.0
65 # which accompanies this distribution, and is available at
66 # http://www.apache.org/licenses/LICENSE-2.0
67 ##############################################################################
68 # these versions are extracted based on the osa commit ${1} on $(git --no-pager log -1 --format=%cI $1)
69 # https://review.openstack.org/gitweb?p=openstack/openstack-ansible.git;a=commit;h=$1""" > $releng_xci_base/file/ansible-role-requirements.yml
70 cat $tempdir/openstack-ansible/ansible-role-requirements.yml >> $releng_xci_base/file/ansible-role-requirements.yml
72 # Update the pinned OSA version
73 sed -i "/^export OPENSTACK_OSA_VERSION/s@:-\"[a-z0-9]*@:-\"${1}@" $releng_xci_base/config/pinned-versions
75 # Update the pinned bifrost version
77 sed -i "/^export OPENSTACK_BIFROST_VERSION/s@:-\"[a-z0-9]*@:-\"${2}@" $releng_xci_base/config/pinned-versions
82 printme "======================= Report ============================"
84 printme "The $releng_xci_base/file/ansible-role-requirements.yml and"
85 printme "$releng_xci_base/config/pinned-versions files have been"
86 printme "updated. Please make sure you test the end result before"
87 printme "committing it!"
89 printme "==========================================================="