From dd4e95cf1d7714031388764b4994f4b8e140caee Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 23 Sep 2025 11:24:01 +0200 Subject: [PATCH 01/11] implement warning for porting MRs with missing float companion branch --- main-basop.yml | 12 ++-- ...ranch-follows-porting-naming-convention.sh | 4 +- ...ranch-exists-for-porting-merge-requests.sh | 55 +++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh diff --git a/main-basop.yml b/main-basop.yml index ba820a5..d03866d 100644 --- a/main-basop.yml +++ b/main-basop.yml @@ -826,8 +826,7 @@ fail-pipeline-if-in-draft: - echo "Your MR is still in Draft state, set it to ready to be mergable, then retrigger the pipeline." - exit 1 -# TODO: decide how to handle this after merge back to main -.check-naming-of-branch-for-basop-update-merges: +check-float-ref-companion-branch-exists-for-porting-merge-request: extends: - .rules-merge-request-to-main - .job-linux @@ -835,10 +834,11 @@ fail-pipeline-if-in-draft: tags: - ivas-basop-linux script: - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh - - if [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[skip[[:space:]_-]name[[:space:]_-]check\] ]] && [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[CI\] ]]; then - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME - - fi + - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-request.sh + + allow_failure: + exit_codes: + - 123 # This job runs in MR pipelines and checks if your branch is up-to-date with your target # If it is not, it fails the whole pipeline early (this should be the first job to run) diff --git a/snippets/basop/branch-follows-porting-naming-convention.sh b/snippets/basop/branch-follows-porting-naming-convention.sh index 962c231..a91881d 100644 --- a/snippets/basop/branch-follows-porting-naming-convention.sh +++ b/snippets/basop/branch-follows-porting-naming-convention.sh @@ -31,7 +31,7 @@ BASOP_PATTERN="^[0-9]+[_-]basop[_-].*" MSG_DOES_NOT_MATCH="Your branch name %s does not match the template '_basop_', e.g. '123_basop_fix_this_one_bug-2'. If this branch is porting a float MR with a corresponding float part, then -ticking to this branch is needed for the testing system to match this branch with its float-reference counterpart. +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 You then also need to create a new merge request and update the links in your issue. @@ -49,3 +49,5 @@ if ! [[ "$1" =~ $BASOP_PATTERN ]]; then printf "$MSG_DOES_NOT_MATCH" "$1" exit 1 fi + +exit 0 diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh new file mode 100644 index 0000000..adf3ef6 --- /dev/null +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -0,0 +1,55 @@ +#!/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 -uxo pipefail + +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). +If this is intended (nothing to port to ivas-float-update), 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. +" + + +bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh +exit_code_is_porting_mr=0 +bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh $CI_COMMIT_REF_NAME | exit_code_is_porting_mr=$? + +# if this does not look like a porting branch, finish with success here - no need to check for a float companion +if [ "$exit_code_is_porting_mr" == "1" ]; then + exit 0 +fi + +# if this does indeed look like a porting branch, get the float companion branch - if that is ivas-float-update, 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) +if [ "$float_ref_branchname" == "ivas-float-update" ]; then + printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "${$CI_COMMIT_REF_NAME/basop/ref}" + exit 123 +fi + +exit 0 -- GitLab From 131f6fa930885ebb3cb565ff156a3373400bf8e1 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 15:54:58 +0200 Subject: [PATCH 02/11] fix script call and job naming --- main-basop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main-basop.yml b/main-basop.yml index 4976a65..479a109 100644 --- a/main-basop.yml +++ b/main-basop.yml @@ -811,7 +811,7 @@ fail-pipeline-if-in-draft: - echo "Your MR is still in Draft state, set it to ready to be mergable, then retrigger the pipeline." - exit 1 -check-float-ref-companion-branch-exists-for-porting-merge-request: +check-float-ref-companion-branch-exists-for-porting-merge-requests: extends: - .rules-merge-request-to-main - .job-linux @@ -819,7 +819,7 @@ check-float-ref-companion-branch-exists-for-porting-merge-request: tags: - ivas-basop-linux script: - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-request.sh + - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh allow_failure: exit_codes: -- GitLab From c9f8271c8d1e17c01a9dc18e10b8aefc54a8fca2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:06:08 +0200 Subject: [PATCH 03/11] change strict mode on scripts --- snippets/basop/branch-follows-porting-naming-convention.sh | 2 ++ ...-ref-companion-branch-exists-for-porting-merge-requests.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/snippets/basop/branch-follows-porting-naming-convention.sh b/snippets/basop/branch-follows-porting-naming-convention.sh index a91881d..a3811b0 100644 --- a/snippets/basop/branch-follows-porting-naming-convention.sh +++ b/snippets/basop/branch-follows-porting-naming-convention.sh @@ -28,6 +28,8 @@ # 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 + BASOP_PATTERN="^[0-9]+[_-]basop[_-].*" MSG_DOES_NOT_MATCH="Your branch name %s does not match the template '_basop_', e.g. '123_basop_fix_this_one_bug-2'. If this branch is porting a float MR with a corresponding float part, then diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index adf3ef6..67b2a9c 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -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. -set -uxo pipefail +set -euo pipefail 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). If this is intended (nothing to port to ivas-float-update), simply ignore this warning. @@ -38,7 +38,7 @@ If there should be a float ref branch for this MR, please check your spelling on bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh exit_code_is_porting_mr=0 -bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh $CI_COMMIT_REF_NAME | exit_code_is_porting_mr=$? +bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh "$CI_COMMIT_REF_NAME" | exit_code_is_porting_mr=$? # if this does not look like a porting branch, finish with success here - no need to check for a float companion if [ "$exit_code_is_porting_mr" == "1" ]; then -- GitLab From 7afb12122d8a75c247da809e236e2f8d198109f7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:10:11 +0200 Subject: [PATCH 04/11] remove obsolete script call --- ...at-ref-companion-branch-exists-for-porting-merge-requests.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index 67b2a9c..f4a78ed 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -35,8 +35,6 @@ If this is intended (nothing to port to ivas-float-update), simply ignore this w 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. " - -bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh exit_code_is_porting_mr=0 bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh "$CI_COMMIT_REF_NAME" | exit_code_is_porting_mr=$? -- GitLab From 19caff67cdaf8d448bc05120f497e0b895f867a2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:12:17 +0200 Subject: [PATCH 05/11] fix "|" -> "||" --- ...at-ref-companion-branch-exists-for-porting-merge-requests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index f4a78ed..6e8af4f 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -36,7 +36,7 @@ If there should be a float ref branch for this MR, please check your spelling on " exit_code_is_porting_mr=0 -bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh "$CI_COMMIT_REF_NAME" | exit_code_is_porting_mr=$? +bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/branch-follows-porting-naming-convention.sh "$CI_COMMIT_REF_NAME" || exit_code_is_porting_mr=$? # if this does not look like a porting branch, finish with success here - no need to check for a float companion if [ "$exit_code_is_porting_mr" == "1" ]; then -- GitLab From b1acebaaffa2c2d30dc8d93ed41d9cc385ca0cc6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:14:23 +0200 Subject: [PATCH 06/11] remove excess "$" --- ...at-ref-companion-branch-exists-for-porting-merge-requests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index 6e8af4f..93f7dd5 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -46,7 +46,7 @@ fi # if this does indeed look like a porting branch, get the float companion branch - if that is ivas-float-update, 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) if [ "$float_ref_branchname" == "ivas-float-update" ]; then - printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "${$CI_COMMIT_REF_NAME/basop/ref}" + printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "${CI_COMMIT_REF_NAME/basop/ref}" exit 123 fi -- GitLab From 384b04747ecea75c5bc4c33d9981ca48daa7acbc Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:20:07 +0200 Subject: [PATCH 07/11] store substitution in variable --- ...t-ref-companion-branch-exists-for-porting-merge-requests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index 93f7dd5..43e4313 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -46,7 +46,8 @@ fi # if this does indeed look like a porting branch, get the float companion branch - if that is ivas-float-update, 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) if [ "$float_ref_branchname" == "ivas-float-update" ]; then - printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "${CI_COMMIT_REF_NAME/basop/ref}" + expected_float_ref_branch="${CI_COMMIT_REF_NAME/basop/ref}" + printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "$expected_float_ref_branch" exit 123 fi -- GitLab From b5811d1d41bc3ff0d384facb27780946a34cdf0a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:21:28 +0200 Subject: [PATCH 08/11] try if printf somehow returns 1 --- ...at-ref-companion-branch-exists-for-porting-merge-requests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index 43e4313..df3b62c 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -47,7 +47,7 @@ fi float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_COMMIT_REF_NAME) if [ "$float_ref_branchname" == "ivas-float-update" ]; then expected_float_ref_branch="${CI_COMMIT_REF_NAME/basop/ref}" - 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" "$expected_float_ref_branch" ||  true exit 123 fi -- GitLab From 5308ab91dd29a1680be75fa766d13bd1d07ac882 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:27:36 +0200 Subject: [PATCH 09/11] add dbg printout --- ...ef-companion-branch-exists-for-porting-merge-requests.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index df3b62c..5d8680d 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -32,7 +32,7 @@ set -euo pipefail 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). If this is intended (nothing to port to ivas-float-update), 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. +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 " exit_code_is_porting_mr=0 @@ -47,7 +47,9 @@ fi float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_COMMIT_REF_NAME) if [ "$float_ref_branchname" == "ivas-float-update" ]; then expected_float_ref_branch="${CI_COMMIT_REF_NAME/basop/ref}" - printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "$expected_float_ref_branch" ||  true + printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "$expected_float_ref_branch" + + echo "Now exiting" exit 123 fi -- GitLab From 9644c23d9bb5e24b1850db74a612693d3ffd36a0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:30:23 +0200 Subject: [PATCH 10/11] source script to get correct exit code --- main-basop.yml | 4 ++-- ...-ref-companion-branch-exists-for-porting-merge-requests.sh | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/main-basop.yml b/main-basop.yml index 479a109..ab046b6 100644 --- a/main-basop.yml +++ b/main-basop.yml @@ -819,8 +819,8 @@ check-float-ref-companion-branch-exists-for-porting-merge-requests: tags: - ivas-basop-linux script: - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh - + # we need to source the script here so that the correct exit code is returned from the global job shell and the "allow_failure" recognizes it + - source "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh allow_failure: exit_codes: - 123 diff --git a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh index 5d8680d..9ed3ae8 100644 --- a/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -48,8 +48,6 @@ float_ref_branchname=$(${CI_PROJECT_DIR}/ivas-codec-ci/snippets/basop/get-float- if [ "$float_ref_branchname" == "ivas-float-update" ]; then expected_float_ref_branch="${CI_COMMIT_REF_NAME/basop/ref}" printf "$MSG_NO_FLOAT_REF_BRANCH_FOUND" "$CI_COMMIT_REF_NAME" "$expected_float_ref_branch" - - echo "Now exiting" exit 123 fi -- GitLab From 17e567ebcc015c3d7c35f4491ec648fef22f6ff7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 29 Sep 2025 16:32:00 +0200 Subject: [PATCH 11/11] remove echo mode from script --- snippets/basop/get-float-ref-branch-name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/basop/get-float-ref-branch-name.sh b/snippets/basop/get-float-ref-branch-name.sh index 4e768aa..b1c2098 100755 --- a/snippets/basop/get-float-ref-branch-name.sh +++ b/snippets/basop/get-float-ref-branch-name.sh @@ -31,7 +31,7 @@ # 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 -set -euxo pipefail +set -euo pipefail if [ $# -ne 1 ]; then echo "Usage: $0 " -- GitLab