Commit 091e5902 authored by Jan Kiene's avatar Jan Kiene
Browse files

Clean up hotfixes and move check to better place

parent 2c94a5a3
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -28,10 +28,19 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.

float_ref_branchname="ivas-float-update"
exit_code_follows_naming_conventions=0
# if branch does not follow the convention, there will be a printout which is irrelevant here, so redirect it to null
bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh $branchname_in >>/dev/null || exit_code_follows_naming_conventions=$?
# if this branch follows the naming convetions, we can try to get the corresponding float MR branch
# if this branch does NOT follow the porting naming convention, the float ref is just ivas-float-update, so skip everything
if [[ "exit_code_follows_naming_conventions" == "0" ]]; then
  float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME)
fi

# fetch all needed branches
git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
git fetch origin ivas-float-update
float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME)
git fetch origin "$float_ref_branchname"

# then check if we are behind the merge target
+9 −15
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
# the United Nations Convention on Contracts on the International Sales of Goods.

# NOTE: this does not check e.g. for float_ref_branchname actually existing and will silently return ivas-float-update if not
#       Use branch-follows-porting-naming-convention.sh for that

if [ $# -ne 1 ]; then
  echo "Usage: $0 <branchname>"
@@ -38,12 +39,6 @@ fi
branchname_in="$1"
branchname_out="ivas-float-update"

exit_code=0
bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh $branchname_in >>/dev/null || exit_code=$?

# if this branch follows the naming convetions, we can try to get the corresponding float MR branch
# if this branch does NOT follow the porting naming convention, the float ref is just ivas-float-update, so skip everything
if [[ "exit_code" == "0" ]]; then
# The float ref branch is just the same name, but with basop -> ref replacement
# Replace only the first occurrence, as "basop" may be present in the later description
# If the format is correct, then before "_basop", only numbers can occur
@@ -54,7 +49,6 @@ if [[ "exit_code" == "0" ]]; then
if [[ "$git_result" =~ "$float_ref_branchname" ]]; then
  branchname_out="${float_ref_branchname}"
fi
fi

echo "$branchname_out"
exit 0