Mark (and use) version with the OSA wrapper script
By doing that, we compute (every bootstrap ansible) the version of OSA, which is then used in playbooks using an env lookup. This is faster than doing the lookup pipe of version in the variable, as this would be computed once, gaining around 0.4s per playbook. This is about as fast as the current static code, and doesn't require bumping at every release. This also allows more flexible releasing (no need to bump metadata here for a minor bump anymore), as we would have only one source of truth. Change-Id: I75657c6dae2c6246ec2513f4ec452a4c354d638b (cherry picked from commitc44fbcbbe3
) (cherry picked from commita30ce47845
) (cherry picked from commit7e0d2e5e5c
)
This commit is contained in:
parent
2ca10ab06e
commit
6ea50bb883
@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
## OpenStack Source Code Release
|
## OpenStack Source Code Release
|
||||||
openstack_release: 17.1.8
|
openstack_release: "{{ lookup('env', 'OSA_VERSION') | default('undefined', true) }}"
|
||||||
|
|
||||||
## Verbosity Options
|
## Verbosity Options
|
||||||
debug: False
|
debug: False
|
||||||
|
@ -173,6 +173,9 @@ PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE}"
|
|||||||
# a different version of Ansible to the one we want to install. As such, we
|
# a different version of Ansible to the one we want to install. As such, we
|
||||||
# use --isolated so that the config file is ignored.
|
# use --isolated so that the config file is ignored.
|
||||||
|
|
||||||
|
# Get current code version (this runs at the root of OSA clone)
|
||||||
|
CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version)
|
||||||
|
|
||||||
# Install ansible and the other required packages
|
# Install ansible and the other required packages
|
||||||
${PIP_COMMAND} install --isolated ${PIP_OPTS} -r requirements.txt ${ANSIBLE_PACKAGE}
|
${PIP_COMMAND} install --isolated ${PIP_OPTS} -r requirements.txt ${ANSIBLE_PACKAGE}
|
||||||
|
|
||||||
@ -208,6 +211,8 @@ sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ans
|
|||||||
# Create openstack ansible wrapper tool
|
# Create openstack ansible wrapper tool
|
||||||
cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible
|
cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible
|
||||||
sed -i "s|OSA_CLONE_DIR|${OSA_CLONE_DIR}|g" /usr/local/bin/openstack-ansible
|
sed -i "s|OSA_CLONE_DIR|${OSA_CLONE_DIR}|g" /usr/local/bin/openstack-ansible
|
||||||
|
# Mark the current OSA version in the wrapper, so we don't need to compute it everytime.
|
||||||
|
sed -i "s|CURRENT_OSA_VERSION|${CURRENT_OSA_VERSION}|g" /usr/local/bin/openstack-ansible
|
||||||
|
|
||||||
# Ensure wrapper tool is executable
|
# Ensure wrapper tool is executable
|
||||||
chmod +x /usr/local/bin/openstack-ansible
|
chmod +x /usr/local/bin/openstack-ansible
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
# OpenStack wrapper tool to ease the use of ansible with multiple variable files.
|
# OpenStack wrapper tool to ease the use of ansible with multiple variable files.
|
||||||
|
|
||||||
export PATH="/opt/ansible-runtime/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
|
export PATH="/opt/ansible-runtime/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
|
||||||
|
export OSA_VERSION="CURRENT_OSA_VERSION"
|
||||||
|
|
||||||
function info {
|
function info {
|
||||||
if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then
|
if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user