From: Dan Mick Date: Thu, 5 Dec 2024 01:12:40 +0000 (-0800) Subject: build_utils.sh, various PR build scripts: skip if container/ X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=391a2970a63f3f7b798b91fdd5ebc6084b759c07;p=ceph-build.git build_utils.sh, various PR build scripts: skip if container/ Parallel to the docs-only test, skip PR checks (api, make check, etc.) if the only changes are to the container/ subdirectory Signed-off-by: Dan Mick --- diff --git a/ceph-pr-api/build/build b/ceph-pr-api/build/build index 65eec6ce..b42d410f 100644 --- a/ceph-pr-api/build/build +++ b/ceph-pr-api/build/build @@ -1,8 +1,9 @@ #!/bin/bash -e docs_pr_only -if [ "$DOCS_ONLY" = true ]; then - echo "Only the doc/ dir changed. No need to run make check or API tests." +container_pr_only +if [[ "$DOCS_ONLY" = true || "$CONTAINER_ONLY" = true ]]; then + echo "Only the doc/ or container/ dir changed. No need to run make check or API tests." mkdir -p $WORKSPACE/build/out echo "File created to avoid Jenkins' Artifact Archiving plugin from hanging" > $WORKSPACE/build/out/mgr.foo.log exit 0 diff --git a/ceph-pull-requests-arm64/build/build b/ceph-pull-requests-arm64/build/build index 791cd997..6363853f 100644 --- a/ceph-pull-requests-arm64/build/build +++ b/ceph-pull-requests-arm64/build/build @@ -1,8 +1,9 @@ #!/bin/bash -ex docs_pr_only -if [ "$DOCS_ONLY" = true ]; then - echo "Only the doc/ dir changed. No need to run make check." +container_pr_only +if [[ "$DOCS_ONLY" = true || "$CONTAINER_ONLY" = true ]]; then + echo "Only the doc/ or container/ dir changed. No need to run make check." exit 0 fi diff --git a/ceph-pull-requests/build/build b/ceph-pull-requests/build/build index a21c3d5e..c00613e8 100644 --- a/ceph-pull-requests/build/build +++ b/ceph-pull-requests/build/build @@ -1,8 +1,9 @@ #!/bin/bash -ex docs_pr_only -if [ "$DOCS_ONLY" = true ]; then - echo "Only the doc/ dir changed. No need to run make check." +container_pr_only +if [[ "$DOCS_ONLY" = true || "$CONTAINER_ONLY" = true ]]; then + echo "Only the doc/ or container/ dir changed. No need to run make check." exit 0 fi diff --git a/ceph-windows-pull-requests/build/check_docs_pr_only b/ceph-windows-pull-requests/build/check_docs_pr_only index 94453c15..7659f4a7 100644 --- a/ceph-windows-pull-requests/build/check_docs_pr_only +++ b/ceph-windows-pull-requests/build/check_docs_pr_only @@ -3,7 +3,8 @@ set -o errexit set -o pipefail docs_pr_only -if [ "$DOCS_ONLY" = true ]; then - echo "Only the doc/ dir changed. No need to run Ceph Windows tests." +container_pr_only +if [[ "$DOCS_ONLY" = true || "$CONTAINER_ONLY" = true ]]; then + echo "Only the doc/ or container/ dir changed. No need to run Ceph Windows tests." exit 0 fi diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 2a845709..f6c16be3 100755 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -1687,8 +1687,10 @@ maybe_reset_ci_container() { fi } -# NOTE: This function will only work on a Pull Request job! -docs_pr_only() { +# NOTE: These functions will only work on a Pull Request job! +pr_only_for() { + local egrep_pattern=$1 + pushd . # Only try to cd to ceph repo if we need to. # The ceph-pr-commits job checks out ceph.git and ceph-build.git but most @@ -1702,13 +1704,22 @@ docs_pr_only() { else files="$(git diff --name-only origin/${ghprbTargetBranch}...origin/pr/${ghprbPullId}/head)" fi + popd echo -e "changed files:\n$files" - if [ $(echo "$files" | egrep -v '^(doc/|admin/)' | wc -l) -gt 0 ]; then - DOCS_ONLY=false - else - DOCS_ONLY=true + if [ $(echo "$files" | egrep -v $egrep_pattern | wc -l) -gt 0 ]; then + return 1 fi - popd + return 0 +} + +docs_pr_only() { + DOCS_ONLY=false + if pr_only_for '^(doc/|admin/)'; then DOCS_ONLY=true; fi +} + +container_pr_only() { + CONTAINER_ONLY=false + if pr_only_for '^container/'; then CONTAINER_ONLY=true; fi } function ssh_exec() {