From b035d6a7353e81533e43ea7234a088bedf917845 Mon Sep 17 00:00:00 2001 From: Ionut Balutoiu Date: Thu, 22 Sep 2022 12:41:23 +0300 Subject: [PATCH] ceph-windows: Update `ceph-windows-test` Jenkins job 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 --- .../build/{build => check_docs_pr_only} | 7 --- .../ceph-windows-pull-requests.yml | 5 +- ceph-windows-test/build/get_chacra_build | 20 -------- .../config/definitions/ceph-windows-test.yml | 46 ++++++++++++++----- scripts/ceph-windows/run_tests | 34 +++++++++++--- scripts/ceph-windows/win32_build | 10 ++++ 6 files changed, 75 insertions(+), 47 deletions(-) rename ceph-windows-pull-requests/build/{build => check_docs_pr_only} (56%) delete mode 100644 ceph-windows-test/build/get_chacra_build create mode 100644 scripts/ceph-windows/win32_build diff --git a/ceph-windows-pull-requests/build/build b/ceph-windows-pull-requests/build/check_docs_pr_only similarity index 56% rename from ceph-windows-pull-requests/build/build rename to ceph-windows-pull-requests/build/check_docs_pr_only index 39f52baa..94453c15 100644 --- a/ceph-windows-pull-requests/build/build +++ b/ceph-windows-pull-requests/build/check_docs_pr_only @@ -7,10 +7,3 @@ 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/config/definitions/ceph-windows-pull-requests.yml b/ceph-windows-pull-requests/config/definitions/ceph-windows-pull-requests.yml index 292821ae..af6cfb59 100644 --- a/ceph-windows-pull-requests/config/definitions/ceph-windows-pull-requests.yml +++ b/ceph-windows-pull-requests/config/definitions/ceph-windows-pull-requests.yml @@ -66,13 +66,14 @@ - 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 index 16043922..00000000 --- a/ceph-windows-test/build/get_chacra_build +++ /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 diff --git a/ceph-windows-test/config/definitions/ceph-windows-test.yml b/ceph-windows-test/config/definitions/ceph-windows-test.yml index c45ca997..f11ae627 100644 --- a/ceph-windows-test/config/definitions/ceph-windows-test.yml +++ b/ceph-windows-test/config/definitions/ceph-windows-test.yml @@ -11,27 +11,51 @@ 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 diff --git a/scripts/ceph-windows/run_tests b/scripts/ceph-windows/run_tests index d194e044..b9c3aa33 100644 --- a/scripts/ceph-windows/run_tests +++ b/scripts/ceph-windows/run_tests @@ -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 index 00000000..cb4087a8 --- /dev/null +++ b/scripts/ceph-windows/win32_build @@ -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 -- 2.47.3