Commit 50efe2d6 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'kiene/warning-for-basop-porting-naming-check' into 'main'

warning for basop porting naming check

See merge request !45
parents 4a44bc29 17e567eb
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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)
+5 −1
Original line number Diff line number Diff line
@@ -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 '<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
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 <new branch name here>
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
+54 −0
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

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
+1 −1
Original line number Diff line number Diff line
@@ -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 <branchname>"