diff --git a/.drone.jsonnet b/.drone.jsonnet index f733a3aa8..334237e3a 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -15,14 +15,9 @@ local platforms_arm = { "stable-23.10": ["rockylinux:8", "rockylinux:9", "debian:12", "ubuntu:22.04", "ubuntu:24.04"], }; -local rewrite_ubuntu_mirror = @"sed -i 's|//\\(us\\.\\)\\?archive\\.ubuntu\\.com|//us.archive.ubuntu.com|g' /etc/apt/sources.list || true; " + - @"sed -i 's|//\\(us\\.\\)\\?archive\\.ubuntu\\.com|//us.archive.ubuntu.com|g' /etc/apt/sources.list.d/ubuntu.sources || true; " + - "cat /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list | grep archive || true; "; - local customEnvCommandsMap = { // 'clang-18': ['apt install -y clang-18', 'export CC=/usr/bin/clang-18', 'export CXX=/usr/bin/clang++-18'], "clang-20": [ - rewrite_ubuntu_mirror, "apt-get clean && apt-get update", "apt-get install -y wget curl lsb-release software-properties-common gnupg", "wget https://apt.llvm.org/llvm.sh", @@ -144,14 +139,6 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", local server_remote = if (std.endsWith(server, "enterprise")) then "https://github.com/mariadb-corporation/MariaDBEnterprise" else "https://github.com/MariaDB/server", - local sccache_arch = if (arch == "amd64") then "x86_64" else "aarch64", - local get_sccache = ["echo getting sccache...", - rewrite_ubuntu_mirror, - "(apt-get clean && apt-get update -y && apt-get install -y curl || yum install -y curl || true)", - "curl -L -o sccache.tar.gz https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-" + sccache_arch + "-unknown-linux-musl.tar.gz &&", - "tar xzf sccache.tar.gz", - "install sccache*/sccache /usr/local/bin/ && echo sccache installed"], - local pipeline = self, publish(step_prefix="pkg", eventp=event + "/${DRONE_BUILD_NUMBER}"):: { @@ -220,9 +207,6 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", local execInnerDocker(command, containerName, flags="") = "docker exec " + flags + " -t " + containerName + " " + command, - local execInnerDockerNoTTY(command, containerName, flags="") = - "docker exec " + flags + " " + containerName + " " + command, - local getContainerName(stepname) = stepname + "$${DRONE_BUILD_NUMBER}", local installCmapi(containerName, pkg_format) = @@ -278,12 +262,15 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", }, commands: [ prepareTestContainer(getContainerName("upgrade") + version, result, false), - if (pkg_format == "deb") - then execInnerDocker('bash -c "./upgrade_setup_deb.sh ' + version + " " + result + " " + arch + " " + repo_pkg_url_no_res + ' $${UPGRADE_TOKEN}"', - getContainerName("upgrade") + version), - if (pkg_format == "rpm") - then execInnerDocker('bash -c "./upgrade_setup_rpm.sh ' + version + " " + result + " " + arch + " " + repo_pkg_url_no_res + ' $${UPGRADE_TOKEN}"', - getContainerName("upgrade") + version), + + execInnerDocker('bash -c "./upgrade_setup_' + pkg_format + '.sh ' + + version + ' ' + + result + ' ' + + arch + ' ' + + repo_pkg_url_no_res + + ' $${UPGRADE_TOKEN}"', + getContainerName("upgrade") + version + ) ], }, upgradelog:: { diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 683828821..368b39501 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -95,8 +95,6 @@ install_sccache() { message "getting sccache..." - rewrite_ubuntu_mirror #TODO - if command -v apt-get &>/dev/null; then apt-get clean apt-get update -y @@ -109,9 +107,11 @@ install_sccache() { "https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-${sccache_arch}-unknown-linux-musl.tar.gz" tar xzf sccache.tar.gz - install sccache*/sccache /usr/local/bin/ && echo "sccache installed" + install sccache*/sccache /usr/local/bin/ && message "sccache installed" } +install_sccache + install_deps() { if [[ $INSTALL_DEPS = false ]]; then return diff --git a/build/prepare_test_container.sh b/build/prepare_test_container.sh index 924382bcf..e5bacee39 100755 --- a/build/prepare_test_container.sh +++ b/build/prepare_test_container.sh @@ -103,6 +103,7 @@ fi # install deps if [[ "$RESULT" == *rocky* ]]; then + execInnerDockerWithRetry "$CONTAINER_NAME" 'dnf install -y dnf-plugins-core && dnf config-manager --set-enabled crb' execInnerDockerWithRetry "$CONTAINER_NAME" 'yum update -y && yum install -y cracklib-dicts diffutils elfutils epel-release expect findutils iproute gawk gcc-c++ gdb hostname lz4 patch perl procps-ng rsyslog sudo tar wget which' else change_ubuntu_mirror_in_docker "$CONTAINER_NAME" "us" @@ -128,5 +129,5 @@ echo "PrepareTestStage completed in $CONTAINER_NAME" if [[ -z $(docker ps -q --filter "name=${CONTAINER_NAME}") ]]; then start_container prepare_container -else warn "Container ${CONTAINER_NAME} is already running!" +else message "Container ${CONTAINER_NAME} is already running, skipping prepare step" fi diff --git a/build/report_test_stage.sh b/build/report_test_stage.sh index 1be7cf140..89a74d4b9 100755 --- a/build/report_test_stage.sh +++ b/build/report_test_stage.sh @@ -22,6 +22,12 @@ cleanup() { #Remove the container on exit trap cleanup EXIT +for flag in CONTAINER_NAME RESULT STAGE; do + if [[ -z "${!flag}" ]]; then + error "Missing required flag: -${flag:0:1} / --${flag,,}" + exit 1 + fi +done if [[ "$EUID" -ne 0 ]]; then error "Please run script as root" diff --git a/build/run_regression.sh b/build/run_regression.sh index e2bd3324a..029c417a3 100755 --- a/build/run_regression.sh +++ b/build/run_regression.sh @@ -12,7 +12,7 @@ optparse.define short=t long=regression-timeout desc="Timeout for the regression optparse.define short=n long=test-name desc="Name of regression test to execute" variable=TEST_NAME source "$(optparse.build)" -for flag in CONTAINER_NAME REGRESSION_BRANCH DISTRO; do +for flag in CONTAINER_NAME REGRESSION_BRANCH DISTRO REGRESSION_TIMEOUT TEST_NAME; do if [[ -z "${!flag}" ]]; then error "Missing required flag: -${flag:0:1} / --${flag,,}" exit 1 diff --git a/build/utils.sh b/build/utils.sh index d2551655a..42ee52077 100644 --- a/build/utils.sh +++ b/build/utils.sh @@ -548,15 +548,6 @@ function execInnerDockerNoTTY() { fi } -function change_ubuntu_mirror() { - local region="$1" - message "Changing Ubuntu mirror to $region" - sed -i "s|//\(${region}\.\)\?archive\.ubuntu\.com|//${region}.archive.ubuntu.com|g" /etc/apt/sources.list 2>/dev/null || true - sed -i "s|//\(${region}\.\)\?archive\.ubuntu\.com|//${region}.archive.ubuntu.com|g" /etc/apt/sources.list.d/ubuntu.sources 2>/dev/null || true - cat /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list 2>/dev/null | grep archive || true - message_split -} - function execInnerDockerWithRetry() { local max_retries=5 local container_name=$1 @@ -583,6 +574,15 @@ function execInnerDockerWithRetry() { return 0 } +function change_ubuntu_mirror() { + local region="$1" + message "Changing Ubuntu mirror to $region" + sed -i "s|//\(${region}\.\)\?archive\.ubuntu\.com|//${region}.archive.ubuntu.com|g" /etc/apt/sources.list 2>/dev/null || true + sed -i "s|//\(${region}\.\)\?archive\.ubuntu\.com|//${region}.archive.ubuntu.com|g" /etc/apt/sources.list.d/ubuntu.sources 2>/dev/null || true + cat /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list 2>/dev/null | grep archive || true + message_split +} + change_ubuntu_mirror_in_docker() { local container_name=$1 local region=$2