]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-windows: Build Ceph on Windows inside libvirt VM 2105/head
authorIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Fri, 3 Feb 2023 08:44:40 +0000 (10:44 +0200)
committerIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Fri, 3 Feb 2023 10:19:44 +0000 (12:19 +0200)
Make sure that the Ceph on Windows build is done inside an Ubuntu
libvirt VM. This ensures that the build is done on a clean environment
on each job run.

After the Windows build is done, the Ubuntu VM is rebuilt to ensure
that Ceph vstart will have a clean environment as well.

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

index 3c9278a22dcb98602871f55012218d58f09b5b7d..afcb116afb3a9a37fae6bf93e9db4a60343c30b5 100644 (file)
         !include-raw:
           - ../../../scripts/build_utils.sh
           - ../../build/check_docs_pr_only
-          - ../../../scripts/ceph-windows/win32_build
           - ../../../scripts/ceph-windows/setup_libvirt
           - ../../../scripts/ceph-windows/setup_libvirt_ubuntu_vm
+          - ../../../scripts/ceph-windows/win32_build
+          - ../../../scripts/ceph-windows/cleanup_libvirt_ubuntu_vm
+          - ../../../scripts/ceph-windows/setup_libvirt_ubuntu_vm
           - ../../../scripts/ceph-windows/setup_libvirt_windows_vm
           - ../../../scripts/ceph-windows/setup_ceph_vstart
           - ../../../scripts/ceph-windows/run_tests
index 6eff5d31c1f372116ab8d1b82d2eef034ba275e9..bf2f836cc8942b0df1d11e6277d19befc8964a1e 100644 (file)
       - shell:
           !include-raw:
             - ../../../scripts/build_utils.sh
-            - ../../../scripts/ceph-windows/win32_build
             - ../../../scripts/ceph-windows/setup_libvirt
             - ../../../scripts/ceph-windows/setup_libvirt_ubuntu_vm
+            - ../../../scripts/ceph-windows/win32_build
+            - ../../../scripts/ceph-windows/cleanup_libvirt_ubuntu_vm
+            - ../../../scripts/ceph-windows/setup_libvirt_ubuntu_vm
             - ../../../scripts/ceph-windows/setup_libvirt_windows_vm
             - ../../../scripts/ceph-windows/setup_ceph_vstart
             - ../../../scripts/ceph-windows/run_tests
diff --git a/scripts/ceph-windows/cleanup_libvirt_ubuntu_vm b/scripts/ceph-windows/cleanup_libvirt_ubuntu_vm
new file mode 100644 (file)
index 0000000..8dc53bd
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -o errexit
+set -o pipefail
+
+if [[ -z $UBUNTU_VM_NAME ]]; then echo "ERROR: The env variable UBUNTU_VM_NAME is not set"; exit 1; fi
+
+# Destroy and undefine the VM
+sudo virsh destroy $UBUNTU_VM_NAME
+sudo virsh undefine $UBUNTU_VM_NAME --remove-all-storage
index 798e79aa9567536dca88e361403e9a2a83021229..424b05a4ef52b5dceae162f8e220a0e8bea545ed 100644 (file)
@@ -21,6 +21,10 @@ function rsync_cmd() {
 # Build Ceph vstart
 #
 cat > ${VSTART_DIR}/build-ceph-vstart.sh << EOF
+#!/usr/bin/env bash
+set -o errexit
+set -o pipefail
+
 cd ~/ceph
 ./install-deps.sh
 ./do_cmake.sh \
index aeb619a4911c02263264146ddedd5e3fc40e2e08..7f7568ede97168c9cfa38aba177bf31dac446160 100644 (file)
@@ -2,10 +2,37 @@
 set -o errexit
 set -o pipefail
 
+if [[ -z $SSH_KEY ]]; then echo "ERROR: The SSH_KEY env variable is not set"; exit 1; fi
+if [[ -z $SSH_KNOWN_HOSTS_FILE ]]; then echo "ERROR: The SSH_KNOWN_HOSTS_FILE env variable is not set"; exit 1; fi
+
+if [[ -z $UBUNTU_SSH_USER ]]; then echo "ERROR: The UBUNTU_SSH_USER env variable is not set"; exit 1; fi
+if [[ -z $UBUNTU_VM_IP ]]; then echo "ERROR: The UBUNTU_VM_IP env variable is not set"; exit 1; fi
+
+export SSH_USER=$UBUNTU_SSH_USER
+export SSH_ADDRESS=$UBUNTU_VM_IP
+
+function rsync_cmd() {
+    rsync -a --delete -e "ssh -i $SSH_KEY -o UserKnownHostsFile=$SSH_KNOWN_HOSTS_FILE" ${@}
+}
+
 #
 # Build Ceph Windows
 #
-cd $WORKSPACE/ceph
+cat > ${WORKSPACE}/build-ceph-windows.sh << EOF
+#!/usr/bin/env bash
+set -o errexit
+set -o pipefail
+
+cd ~/ceph
+
+sudo apt-get update
+sudo apt-get install -y git
 git submodule update --init --recursive
-ZIP_DEST=$WORKSPACE/ceph.zip $CEPH_WIN32_BUILD_FLAGS timeout 3h ./win32_build.sh
-rm -rf build
+
+ZIP_DEST=~/ceph.zip $CEPH_WIN32_BUILD_FLAGS timeout 3h ./win32_build.sh
+EOF
+chmod +x ${WORKSPACE}/build-ceph-windows.sh
+time rsync_cmd $WORKSPACE/ceph ${WORKSPACE}/build-ceph-windows.sh ${UBUNTU_SSH_USER}@${UBUNTU_VM_IP}:
+
+time SSH_TIMEOUT=3h ssh_exec ./build-ceph-windows.sh
+time rsync_cmd ${UBUNTU_SSH_USER}@${UBUNTU_VM_IP}:~/ceph.zip $WORKSPACE/ceph.zip