Fix DIB_REPOREF_amphora_agent not set on Git !=1.8.5

Setting DIB_REPOREF_amphora_agent with git -c does not work. The option
-c is for passing key-value configurations and git -C option was
introduced in git v1.8.5 which some distros do not include (e.g. CentOS
7.5 ships with git v1.8.3.1). As a result, DIB_REPOREF_amphora_agent is
not set on any git version !=1.8.5.

The alternative that works across all tested Git versions is: git
--git-dir=/.git sub-command

Change-Id: I41993fa0f8bfde4b7ca9509872de5b54e2ed5680
Story: 2003067
Task: 23114
This commit is contained in:
Carlos Goncalves 2018-07-23 14:49:56 +02:00
parent 5b2dab15b7
commit 88649d9547
1 changed files with 1 additions and 6 deletions

View File

@ -56,13 +56,8 @@ function build_octavia_worker_image {
export DIB_REPOLOCATION_pip_and_virtualenv=file://$GET_PIP_CACHE_LOCATION
fi
export DIB_REPOLOCATION_amphora_agent=$OCTAVIA_DIR
export DIB_REPOREF_amphora_agent=$(git --git-dir="$OCTAVIA_DIR/.git" log -1 --pretty="format:%H")
git_minimum_version=$(git --version | awk '{print $NF "\n1.8.5" }' | sort -V | head -1)
if [[ ${git_minimum_version} == "1.8.5" ]]; then
export DIB_REPOREF_amphora_agent=$(git -C "$OCTAVIA_DIR" log -1 --pretty="format:%H")
else
export DIB_REPOREF_amphora_agent=$(git -c "$OCTAVIA_DIR" log -1 --pretty="format:%H")
fi
TOKEN=$(openstack token issue -f value -c id)
die_if_not_set $LINENO TOKEN "Keystone failed to get token."