]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-windows: Update `ceph-windows-test` Jenkins job 2079/head
authorIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Thu, 22 Sep 2022 09:41:23 +0000 (12:41 +0300)
committerIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Thu, 22 Sep 2022 12:33:59 +0000 (15:33 +0300)
Make the Jenkins `ceph-windows-test` similar to `ceph-windows-pull-requests` job.

However, `ceph-windows-test` is meant to be triggered on-demand, and it
exposes more parameters for `win32_build.sh` script, and artifacts collected
at the end of the job run.

The new `ceph-windows-test` Jenkins job will have the following new parameters:

* `CEPH_GIT_REPO` - The Ceph git repo used to clone.
* `CEPH_GIT_BRANCH` - The Ceph git branch name used to clone.
* `CEPH_WIN32_BUILD_FLAGS` - Build flags passed to `win32_build.sh`
   besides the defaults.
* `INCLUDE_USERSPACE_CRASH_DUMPS` - Collect Windows userspace crash dumps
   with the job artifacts.
* `INCLUDE_CEPH_ZIP` - Collect the `ceph.zip` Windows build with the
   job artifacts. This is useful for debugging failures locally.

Also, create `scripts/ceph-windows/win32_build` common script. This is
used in both Jenkins jobs to cross-build Ceph Windows.

Besides this, we collect artifacts with `trap EXIT` instance.
Previously, if the tests failed, the artifacts wouldn't be collected.

Due to the fact that artifacts collected might occupy more space,
we limit `artifact-num-to-keep` to `15`.

Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
ceph-windows-pull-requests/build/build [deleted file]
ceph-windows-pull-requests/build/check_docs_pr_only [new file with mode: 0644]
ceph-windows-pull-requests/config/definitions/ceph-windows-pull-requests.yml
ceph-windows-test/build/get_chacra_build [deleted file]
ceph-windows-test/config/definitions/ceph-windows-test.yml
scripts/ceph-windows/run_tests
scripts/ceph-windows/win32_build [new file with mode: 0644]

diff --git a/ceph-windows-pull-requests/build/build b/ceph-windows-pull-requests/build/build
deleted file mode 100644 (file)
index 39f52ba..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-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."
-    exit 0
-fi
-
-#
-# Build Ceph Windows
-#
-cd $WORKSPACE/ceph
-git submodule update --init --recursive
-ZIP_DEST=$WORKSPACE/ceph.zip timeout 3h ./win32_build.sh
diff --git a/ceph-windows-pull-requests/build/check_docs_pr_only b/ceph-windows-pull-requests/build/check_docs_pr_only
new file mode 100644 (file)
index 0000000..94453c1
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+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."
+    exit 0
+fi
index 292821aee50463b1a17e0cf2b4481beb53378323..af6cfb59742e127bceaaf970db48788fd8c1fefc 100644 (file)
     - shell:
         !include-raw:
           - ../../../scripts/build_utils.sh
-          - ../../build/build
+          - ../../build/check_docs_pr_only
+          - ../../../scripts/ceph-windows/win32_build
           - ../../../scripts/ceph-windows/setup_libvirt_vm
           - ../../../scripts/ceph-windows/run_tests
 
     publishers:
       - archive:
-          artifacts: 'logs/**'
+          artifacts: 'artifacts/**'
           allow-empty: true
           latest-only: false
 
diff --git a/ceph-windows-test/build/get_chacra_build b/ceph-windows-test/build/get_chacra_build
deleted file mode 100644 (file)
index 1604392..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit
-set -o pipefail
-
-CEPH_WINDOWS_VERSION=${CEPH_WINDOWS_VERSION:-"1809"}
-CEPH_WINDOWS_BRANCH=${CEPH_WINDOWS_BRANCH:-"main"}
-CEPH_WINDOWS_SHA1=${CEPH_WINDOWS_SHA1:-"latest"}
-
-GET_BIN_SCRIPT_URL="https://raw.githubusercontent.com/ceph/ceph-win32-tests/main/get-bin.py"
-
-#
-# Download the Chacra Ceph Windows build
-#
-cd $WORKSPACE
-timeout 1m curl -L -o ./get-chacra-bin.py $GET_BIN_SCRIPT_URL
-chmod +x ./get-chacra-bin.py
-timeout 10m ./get-chacra-bin.py \
-    --distrover $CEPH_WINDOWS_VERSION \
-    --branchname $CEPH_WINDOWS_BRANCH \
-    --sha1 $CEPH_WINDOWS_SHA1
index c45ca9976607cf34a017b04fb601845b61157c1e..f11ae6272946b41bc04a2eab07176c115ccb0a36 100644 (file)
           days-to-keep: 30
           num-to-keep: 30
           artifact-days-to-keep: 30
-          artifact-num-to-keep: 30
+          artifact-num-to-keep: 15
 
     parameters:
       - string:
-          name: CEPH_WINDOWS_VERSION
-          description: "The Windows version for the Ceph build."
-          default: 1809
+          name: CEPH_GIT_REPO
+          description: "The Ceph git repo."
+          default: https://github.com/ceph/ceph.git
+
       - string:
-          name: CEPH_WINDOWS_BRANCH
-          description: "The branch name for the Ceph build."
+          name: CEPH_GIT_BRANCH
+          description: "The Ceph git branch name."
           default: main
+
       - string:
-          name: CEPH_WINDOWS_SHA1
-          description: "The SHA1 for the Ceph build."
-          default: latest
+          name: CEPH_WIN32_BUILD_FLAGS
+          description: |
+            Space-separated list of key=value items passed as environment variables to Ceph './win32_build.sh' script.
+            For example: "ENABLE_SHARED=True NUM_WORKERS=4". If this is not set, the default build flags are used.
+
+      - bool:
+          name: INCLUDE_USERSPACE_CRASH_DUMPS
+          description: "Include Windows user-space crash dumps in the artifacts collected."
+
+      - bool:
+          name: INCLUDE_CEPH_ZIP
+          description: "Include Ceph Windows zip (useful for debugging with symbol files) in the artifacts collected."
+
+    scm:
+      - git:
+          url: $CEPH_GIT_REPO
+          branches:
+            - $CEPH_GIT_BRANCH
+          browser: auto
+          timeout: 20
+          do-not-fetch-tags: true
+          shallow-clone: true
+          honor-refspec: true
+          wipe-workspace: true
+          basedir: ceph
 
     builders:
       - shell:
           !include-raw:
-            - ../../build/get_chacra_build
             - ../../../scripts/build_utils.sh
+            - ../../../scripts/ceph-windows/win32_build
             - ../../../scripts/ceph-windows/setup_libvirt_vm
             - ../../../scripts/ceph-windows/run_tests
 
@@ -43,7 +67,7 @@
 
     publishers:
       - archive:
-          artifacts: 'logs/**'
+          artifacts: 'artifacts/**'
           allow-empty: true
           latest-only: false
 
index d194e044451730c7f98a380aae9256a1db78da0b..b9c3aa331f2a5ac95dc445283b25ad8318dc15a9 100644 (file)
@@ -8,6 +8,7 @@ if [[ ! -f $WORKSPACE/ceph.zip ]]; then
 fi
 
 CEPHADM_RELEASE=${CEPHADM_RELEASE:-"quincy"}
+WIN_USERSPACE_CRASH_DUMPS=${WIN_USERSPACE_CRASH_DUMPS:-"C:\\userspace_crash_dumps"}
 
 #
 # Install requirements (if needed)
@@ -48,6 +49,16 @@ sudo chown $USER $WORKSPACE/ceph.conf $WORKSPACE/keyring
 
 sudo ceph osd pool create rbd
 
+#
+# Clone ceph-win32-tests repo
+#
+SSH_TIMEOUT=5m ssh_exec git.exe clone https://github.com/ceph/ceph-win32-tests.git /workspace/repos/ceph-win32-tests
+
+#
+# Set Windows user-space crash dumps directory
+#
+ssh_exec powershell.exe /workspace/repos/ceph-win32-tests/test_host/set_userspace_crashdump_location.ps1 -dumpDir $WIN_USERSPACE_CRASH_DUMPS
+
 #
 # Copy the ceph.conf and keyring to the Windows VM
 #
@@ -64,14 +75,23 @@ ssh_exec powershell.exe "New-Service -Name ceph-rbd -BinaryPathName 'c:\ceph\rbd
 ssh_exec powershell.exe Start-Service -Name ceph-rbd
 
 #
-# Run the Windows tests
+# Collect artifacts on script exit
 #
-SSH_TIMEOUT=5m ssh_exec git.exe clone https://github.com/ceph/ceph-win32-tests.git /workspace/repos/ceph-win32-tests
-SSH_TIMEOUT=1h ssh_exec powershell.exe /workspace/repos/ceph-win32-tests/test_host/run_tests.ps1 -workerCount 4
+function collect_artifacts() {
+    rm -rf $WORKSPACE/artifacts
+    mkdir -p $WORKSPACE/artifacts
+
+    scp_download /workspace/test_results $WORKSPACE/artifacts/test_results
+    if [[ "$INCLUDE_USERSPACE_CRASH_DUMPS" = true ]]; then
+        scp_download /userspace_crash_dumps $WORKSPACE/artifacts/userspace_crash_dumps
+    fi
+    if [[ "$INCLUDE_CEPH_ZIP" = true ]]; then
+        cp $WORKSPACE/ceph.zip $WORKSPACE/artifacts/ceph.zip
+    fi
+}
+trap collect_artifacts EXIT
 
 #
-# Collect logs
+# Run the Windows tests
 #
-rm -rf $WORKSPACE/logs
-mkdir -p $WORKSPACE/logs
-scp_download /workspace/test_results $WORKSPACE/logs/test_results
+SSH_TIMEOUT=1h ssh_exec powershell.exe /workspace/repos/ceph-win32-tests/test_host/run_tests.ps1 -workerCount 4
diff --git a/scripts/ceph-windows/win32_build b/scripts/ceph-windows/win32_build
new file mode 100644 (file)
index 0000000..cb4087a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -o errexit
+set -o pipefail
+
+#
+# Build Ceph Windows
+#
+cd $WORKSPACE/ceph
+git submodule update --init --recursive
+ZIP_DEST=$WORKSPACE/ceph.zip $CEPH_WIN32_BUILD_FLAGS timeout 3h ./win32_build.sh