]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
Revert "removed build_utils dependency from ceph pull request job" 2414/head
authorDan Mick <dan.mick@redhat.com>
Tue, 29 Jul 2025 18:24:40 +0000 (11:24 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 29 Jul 2025 18:24:40 +0000 (11:24 -0700)
Jobs are using more than just the 'docs check' functions in
build_utils.sh (ssh_exec, get_nr_build_jobs are two that showed up
after merge).  Revert this until it can be more-carefully evaluated.

This reverts commit 28871177b6102eb3b17e260341eaa05a861628c1.

ceph-pr-api/config/definitions/ceph-pr-api.yml
ceph-pr-commits/config/definitions/ceph-pr-commits.yml
ceph-pull-requests-arm64/config/definitions/ceph-pull-requests-arm64.yml
ceph-pull-requests/config/definitions/ceph-pull-requests.yml
ceph-windows-pull-requests/config/definitions/ceph-windows-pull-requests.yml
scripts/build_utils.sh
scripts/pr_checks.sh [deleted file]

index 9c251b3469ce898028e861bbbf3978105c0d97f8..b2afd6a96d6183db0e827f40843436eba52160d4 100644 (file)
@@ -66,7 +66,7 @@
     builders:
       - shell:
           !include-raw-verbatim:
-            - ../../../scripts/pr_checks.sh
+            - ../../../scripts/build_utils.sh
             - ../../build/build
             - ../../../scripts/dashboard/install-backend-api-test-deps.sh
             - ../../build/api
index fd81601c3f3acb8f281d3ca3f6738e4842fdd3da..38fa5446110c530a6f457044ab6ea856306d8fe5 100644 (file)
@@ -73,7 +73,6 @@
       - shell:
           !include-raw-verbatim:
             - ../../../scripts/build_utils.sh
-            - ../../../scripts/pr_checks.sh
             - ../../build/build
 
     publishers:
index 30140a9ce92836a50a8b35dc7028f20fd509e120..624fa8c20b91fdc73aa80df33ac4a19a3b261398 100644 (file)
@@ -4,7 +4,7 @@
     builders:
     - shell:
         !include-raw-verbatim:
-          - ../../../scripts/pr_checks.sh
+          - ../../../scripts/build_utils.sh
           - ../../build/build
     concurrent: true
     disabled: false
index f8d6a47daae40412de8e55d732ebf129c382e5ae..8cef990cbfe1e060aab91918e59570ac1e0a6c64 100644 (file)
@@ -62,7 +62,7 @@
     builders:
     - shell:
         !include-raw-verbatim:
-          - ../../../scripts/pr_checks.sh
+          - ../../../scripts/build_utils.sh
           - ../../build/build
 
     publishers:
index 23e82283eb7f1eccb05e49b74ea57aacb280c99b..abd1d797a7133580b55120a3a5511ac1ccfd52c5 100644 (file)
@@ -67,7 +67,7 @@
     builders:
     - shell:
         !include-raw-verbatim:
-          - ../../../scripts/pr_checks.sh
+          - ../../../scripts/build_utils.sh
           - ../../build/check_docs_pr_only
           - ../../../scripts/ceph-windows/setup_libvirt
           - ../../../scripts/ceph-windows/setup_libvirt_ubuntu_vm
index 334d6aab4be2e5ff8c27d9ea49915e092d66d381..598b1bf301d4ec6a118ef3ac529c8d616a9398f3 100755 (executable)
@@ -1694,6 +1694,70 @@ maybe_reset_ci_container() {
     fi
 }
 
+# NOTE: These functions will only work on a Pull Request job!
+pr_only_for() {
+  # $1 is passed by reference to avoid having to call with ${array[@]} and
+  # receive by creating another local array ("$@")
+  local -n local_patterns=$1
+  local files
+  pushd .
+  # cd to ceph repo if we need to.
+  # The ceph-pr-commits job checks out ceph.git and ceph-build.git but most
+  # other jobs do not.
+  if ! [[ "$(git config --get remote.origin.url)" =~ "ceph/ceph.git" ]]; then
+    cd "$WORKSPACE/ceph"
+  fi
+  if [ -f $(git rev-parse --git-dir)/shallow ]; then
+    # We can't do a regular `git diff` in a shallow clone.  There is no other way to check files changed.
+    files="$(curl -s -u ${GITHUB_USER}:${GITHUB_PASS} https://api.github.com/repos/${ghprbGhRepository}/pulls/${ghprbPullId}/files | jq '.[].filename' | tr -d '"')"
+  else
+    files="$(git diff --name-only origin/${ghprbTargetBranch}...origin/pr/${ghprbPullId}/head)"
+  fi
+  popd
+  echo -e "changed files:\n$files"
+  # 0 is true, 1 is false
+  local all_match=0
+  for f in $files; do
+    local match=1
+    for p in "${local_patterns[@]}"; do
+      # pattern loop: if one pattern matches, skip the others
+      if [[ $f == $p ]]; then match=0; break; fi
+    done
+    # file loop: if this file matched no patterns, the group fails
+    # (one mismatch spoils the whole bushel)
+    if [[ $match -eq 1 ]] ; then all_match=1; break; fi
+  done
+  return $all_match
+}
+
+docs_pr_only() {
+  DOCS_ONLY=false
+  local patterns=(
+    'doc/*'
+    'admin/*'
+    'src/sample.ceph.conf'
+    'CodingStyle'
+    '*.rst'
+    '*.md'
+    'COPYING*'
+    'README.*'
+    'SubmittingPatches'
+    '.readthedocs.yml'
+    'PendingReleaseNotes'
+  )
+  if pr_only_for patterns; then DOCS_ONLY=true; fi
+}
+
+container_pr_only() {
+  CONTAINER_ONLY=false
+  local patterns=(
+    'container/*'
+    'Dockerfile.build'
+    'src/script/buildcontainer-setup.sh'
+    'src/script/build-with-container.py'
+  )
+  if pr_only_for patterns; then CONTAINER_ONLY=true; fi
+}
 
 function ssh_exec() {
     if [[ -z $SSH_ADDRESS ]]; then
diff --git a/scripts/pr_checks.sh b/scripts/pr_checks.sh
deleted file mode 100644 (file)
index bf422c6..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash -ex
-# vim: ts=4 sw=4 expandtab
-
-# NOTE: These functions will only work on a Pull Request job!
-pr_only_for() {
-  # $1 is passed by reference to avoid having to call with ${array[@]} and
-  # receive by creating another local array ("$@")
-  local -n local_patterns=$1
-  local files
-  pushd .
-  # cd to ceph repo if we need to.
-  # The ceph-pr-commits job checks out ceph.git and ceph-build.git but most
-  # other jobs do not.
-  if ! [[ "$(git config --get remote.origin.url)" =~ "ceph/ceph.git" ]]; then
-    cd "$WORKSPACE/ceph"
-  fi
-  if [ -f $(git rev-parse --git-dir)/shallow ]; then
-    # We can't do a regular `git diff` in a shallow clone.  There is no other way to check files changed.
-    files="$(curl -s -u ${GITHUB_USER}:${GITHUB_PASS} https://api.github.com/repos/${ghprbGhRepository}/pulls/${ghprbPullId}/files | jq '.[].filename' | tr -d '"')"
-  else
-    files="$(git diff --name-only origin/${ghprbTargetBranch}...origin/pr/${ghprbPullId}/head)"
-  fi
-  popd
-  echo -e "changed files:\n$files"
-  # 0 is true, 1 is false
-  local all_match=0
-  for f in $files; do
-    local match=1
-    for p in "${local_patterns[@]}"; do
-      # pattern loop: if one pattern matches, skip the others
-      if [[ $f == $p ]]; then match=0; break; fi
-    done
-    # file loop: if this file matched no patterns, the group fails
-    # (one mismatch spoils the whole bushel)
-    if [[ $match -eq 1 ]] ; then all_match=1; break; fi
-  done
-  return $all_match
-}
-
-docs_pr_only() {
-  DOCS_ONLY=false
-  local patterns=(
-    'doc/*'
-    'admin/*'
-    'src/sample.ceph.conf'
-    'CodingStyle'
-    '*.rst'
-    '*.md'
-    'COPYING*'
-    'README.*'
-    'SubmittingPatches'
-    '.readthedocs.yml'
-    'PendingReleaseNotes'
-  )
-  if pr_only_for patterns; then DOCS_ONLY=true; fi
-}
-
-container_pr_only() {
-  CONTAINER_ONLY=false
-  local patterns=(
-    'container/*'
-    'Dockerfile.build'
-    'src/script/buildcontainer-setup.sh'
-    'src/script/build-with-container.py'
-  )
-  if pr_only_for patterns; then CONTAINER_ONLY=true; fi
-}
\ No newline at end of file