Commit 227bd777 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'implement-new-naming-scheme-for-parallel-merge-requests' into 'main'

Implement new naming scheme for parallel merge requests

See merge request !67
parents 2e8d607b 1b6037c1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ before_script:
```

- use only one include section at the top of the main yml file to keep things clear, remember that later stuff overwrites earlier stuff
- in general prefer adding scripts here over using yaml anchors in a CI config file
- if your script shall modify some environment variable, you need to run it with `source` instead of calling it.
- the merge CI config in the ivas-* repos can be viewed in the pipeline editor under "full configuration" - this is especially useful when making changes which should not functionally affect the CI, then it is helpful to copy the full merged config with and without the changes and compare the files directly or as parsed yaml dict locally.

+5 −5
Original line number Diff line number Diff line
@@ -30,16 +30,16 @@

set -euo pipefail

BASOP_PATTERN="^[0-9]+[_-]basop[_-].*"
MSG_DOES_NOT_MATCH="Your branch name %s does not match the template '<issue_number>_basop_<description>', e.g. '123_basop_fix_this_one_bug-2'.
If this branch is porting a float MR with a corresponding float part, then
BASOP_PATTERN='^(float|basop)[_-][0-9]+[_-].+$'
MSG_DOES_NOT_MATCH="Your branch name %s does not match the template '[basop|float]-<issue-number>-<description>', e.g. 'basop-123-fix_this_one_bug-2'.
If this branch has a parallel companion MR in the float repo with a corresponding float part, then
sticking to this naming convention is needed for the testing system to match this branch with its float-reference counterpart.
Please rename your branch. You can easily do this by creating a new branch from this branch:
  - git checkout -b <new branch name here>
You then also need to create a new merge request and update the links in your issue.
See here for details on the porting work process: https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/wikis/Porting-MRs-from-floating-point-codec#workflow-for-porting-a-merge-request-from-floating-point-codec-to-basop-codec
See here for details on the naming conventions: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/wikis/Software-development/Development-workflow#workflow-for-parallel-changes-in-fixed--and-floating-point-code

If this is not a porting branch, ignore above message.
If this branch does not have a float companion merge request, ignore above message.
"

if [ $# -ne 1 ]; then
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-nam
# 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-codec main, so skip everything
if [[ "$exit_code_follows_naming_conventions" == "0" ]]; then
  float_ref_branchname_in_ivas_codec=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME)
  float_ref_branchname_in_ivas_codec=$CI_COMMIT_REF_NAME
fi

# fetch merge target and check if we are up-to-date
+3 −4
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
# 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.

MSG_NO_FLOAT_REF_BRANCH_FOUND="Your branch name %s looks like it is a porting MR, but there is no corresponding float merge request (%s).
MSG_NO_FLOAT_REF_BRANCH_FOUND="Your branch name %s conforms to the naming convention for parallel work on float and basop, but there is no corresponding branch of the same name in ivas-codec.
If this is intended (no changes on ivas-codec main), simply ignore this warning.
If there should be a float ref branch for this MR, please check your spelling on your other branch and make sure that you pushed it.\n
"
@@ -44,11 +44,10 @@ if [ "$exit_code_is_porting_mr" == "1" ]; then
fi

# if this does indeed look like a porting branch, get the float companion branch - if that is the default, then warn about possible typo/missing branch
float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_COMMIT_REF_NAME)
float_ref_branchname=$CI_COMMIT_REF_NAME
if [ "$float_ref_branchname" == "main" ]; then
  expected_float_ref_branch="${CI_COMMIT_REF_NAME/basop/ref}"
  set +x
  printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "$expected_float_ref_branch"
  printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME"
  exit 123
fi

+0 −65
Original line number Diff line number Diff line
#!/bin/bash

# (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository. All Rights Reserved.
#
# This software is protected by copyright law and by international treaties.
# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository retain full ownership rights in their respective contributions in
# the software. This notice grants no license of any kind, including but not limited to patent
# license, nor is any license granted by implication, estoppel or otherwise.
#
# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
# contributions.
#
# This software is provided "AS IS", without any express or implied warranties. The software is in the
# development stage. It is intended exclusively for experts who have experience with such software and
# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
# and fitness for a particular purpose are hereby disclaimed and excluded.
#
# Any dispute, controversy or claim arising under or in relation to providing this software shall be
# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
# 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.

set -euo pipefail

# in this snippet, always print stuff to stderr and ONLY the final echo with of branchname_out should go to stdout
exec 3>&1 # save stdout on file desc 3
exec 1>&2 # send all stdout to stderr

if [ $# -ne 1 ]; then
  echo "Usage: $0 <branchname>"
  exit 1
fi

branchname_in="$1"
# Note: this is ivas-codec ("float") main
branchname_out="main"

# 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
float_ref_branchname="${branchname_in/basop/ref}"

# now check in ivas-codec repository if a branch with this name exists
exit_code_ls_remote=0
pushd "${SCRIPTS_DIR}"
git fetch origin
git ls-remote --exit-code --heads origin refs/heads/$float_ref_branchname || exit_code_ls_remote=$?
popd

# If the branch exists, we use it as ref name instead of main
# NOTE: "git ls-remote --exit-code" returns 2 if the given ref was not found
if [ "$exit_code_ls_remote" -eq "0" ]; then
  branchname_out="${float_ref_branchname}"
fi

printf '%s\n' "$branchname_out" >&3
exit 0