]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
build_utils.sh, various PR build scripts: skip if container/ 2298/head
authorDan Mick <dan.mick@redhat.com>
Thu, 5 Dec 2024 01:12:40 +0000 (17:12 -0800)
committerDan Mick <dan.mick@redhat.com>
Thu, 5 Dec 2024 08:25:31 +0000 (00:25 -0800)
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 <dan.mick@redhat.com>
ceph-pr-api/build/build
ceph-pull-requests-arm64/build/build
ceph-pull-requests/build/build
ceph-windows-pull-requests/build/check_docs_pr_only
scripts/build_utils.sh

index 65eec6ce52add33642a62d57829777026b62479c..b42d410f9c1bb81ab5dd7bdd6943d849f9e460f2 100644 (file)
@@ -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
index 791cd997158a4031eeeb31702103551f6614357b..6363853fdb2babbfc80f98a369a6337ec85374c3 100644 (file)
@@ -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
 
index a21c3d5ee84563ad84d6443f75c1cd4cd8bc3998..c00613e8efa9bf6987bfb4db47fd136057fe37c6 100644 (file)
@@ -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
 
index 94453c156a89161fa53612135a461bb4e5da58cf..7659f4a76c289e9daf73d69fc44bac0127cd622e 100644 (file)
@@ -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
index 2a845709ddbb4a8445d24247d97e826a494c1240..f6c16be3419b8a24116dc2cece1eb46881fad4cd 100755 (executable)
@@ -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() {