diff --git a/main-basop.yml b/main-basop.yml index fda6a3fae70f41d66d8d642dec2868c1c0765c8c..ab046b675409c5d4c9a0cf33e274ee66927d93ae 100644 --- a/main-basop.yml +++ b/main-basop.yml @@ -811,8 +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 -# 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-requests: extends: - .rules-merge-request-to-main - .job-linux @@ -820,10 +819,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 + # 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 # 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 962c2315b15f292d84357828e79a597c2bf87108..a3811b0ba2c92fcf793fc57bd7e313a2cf2bae58 100644 --- a/snippets/basop/branch-follows-porting-naming-convention.sh +++ b/snippets/basop/branch-follows-porting-naming-convention.sh @@ -28,10 +28,12 @@ # 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 -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 +51,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 0000000000000000000000000000000000000000..9ed3ae846c3851819d5b5483593c51c50284bb6d --- /dev/null +++ b/snippets/basop/check-float-ref-companion-branch-exists-for-porting-merge-requests.sh @@ -0,0 +1,54 @@ +#!/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 + +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.\n +" + +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 + 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 + +exit 0 diff --git a/snippets/basop/get-float-ref-branch-name.sh b/snippets/basop/get-float-ref-branch-name.sh index 4e768aa3d4a6d35957a367f2dd68ad4b5d0fbf1c..b1c20988bde549a9dcfde9d348acaa77a8677d6b 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 "