1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

chore(ci) MCOL-6071 refactorings

This commit is contained in:
aleksei.bukhalov
2025-06-30 17:37:20 +02:00
committed by Leonid Fedorov
parent a27f30c73e
commit 26fd0ba4bf
6 changed files with 30 additions and 36 deletions

View File

@ -15,14 +15,9 @@ local platforms_arm = {
"stable-23.10": ["rockylinux:8", "rockylinux:9", "debian:12", "ubuntu:22.04", "ubuntu:24.04"], "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 = { local customEnvCommandsMap = {
// 'clang-18': ['apt install -y clang-18', 'export CC=/usr/bin/clang-18', 'export CXX=/usr/bin/clang++-18'], // 'clang-18': ['apt install -y clang-18', 'export CC=/usr/bin/clang-18', 'export CXX=/usr/bin/clang++-18'],
"clang-20": [ "clang-20": [
rewrite_ubuntu_mirror,
"apt-get clean && apt-get update", "apt-get clean && apt-get update",
"apt-get install -y wget curl lsb-release software-properties-common gnupg", "apt-get install -y wget curl lsb-release software-properties-common gnupg",
"wget https://apt.llvm.org/llvm.sh", "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 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, local pipeline = self,
publish(step_prefix="pkg", eventp=event + "/${DRONE_BUILD_NUMBER}"):: { 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="") = local execInnerDocker(command, containerName, flags="") =
"docker exec " + flags + " -t " + containerName + " " + command, "docker exec " + flags + " -t " + containerName + " " + command,
local execInnerDockerNoTTY(command, containerName, flags="") =
"docker exec " + flags + " " + containerName + " " + command,
local getContainerName(stepname) = stepname + "$${DRONE_BUILD_NUMBER}", local getContainerName(stepname) = stepname + "$${DRONE_BUILD_NUMBER}",
local installCmapi(containerName, pkg_format) = local installCmapi(containerName, pkg_format) =
@ -278,12 +262,15 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
}, },
commands: [ commands: [
prepareTestContainer(getContainerName("upgrade") + version, result, false), 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}"', execInnerDocker('bash -c "./upgrade_setup_' + pkg_format + '.sh '
getContainerName("upgrade") + version), + version + ' '
if (pkg_format == "rpm") + result + ' '
then execInnerDocker('bash -c "./upgrade_setup_rpm.sh ' + version + " " + result + " " + arch + " " + repo_pkg_url_no_res + ' $${UPGRADE_TOKEN}"', + arch + ' '
getContainerName("upgrade") + version), + repo_pkg_url_no_res
+ ' $${UPGRADE_TOKEN}"',
getContainerName("upgrade") + version
)
], ],
}, },
upgradelog:: { upgradelog:: {

View File

@ -95,8 +95,6 @@ install_sccache() {
message "getting sccache..." message "getting sccache..."
rewrite_ubuntu_mirror #TODO
if command -v apt-get &>/dev/null; then if command -v apt-get &>/dev/null; then
apt-get clean apt-get clean
apt-get update -y 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" "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 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() { install_deps() {
if [[ $INSTALL_DEPS = false ]]; then if [[ $INSTALL_DEPS = false ]]; then
return return

View File

@ -103,6 +103,7 @@ fi
# install deps # install deps
if [[ "$RESULT" == *rocky* ]]; then 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' 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 else
change_ubuntu_mirror_in_docker "$CONTAINER_NAME" "us" 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 if [[ -z $(docker ps -q --filter "name=${CONTAINER_NAME}") ]]; then
start_container start_container
prepare_container prepare_container
else warn "Container ${CONTAINER_NAME} is already running!" else message "Container ${CONTAINER_NAME} is already running, skipping prepare step"
fi fi

View File

@ -22,6 +22,12 @@ cleanup() {
#Remove the container on exit #Remove the container on exit
trap cleanup 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 if [[ "$EUID" -ne 0 ]]; then
error "Please run script as root" error "Please run script as root"

View File

@ -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 optparse.define short=n long=test-name desc="Name of regression test to execute" variable=TEST_NAME
source "$(optparse.build)" 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 if [[ -z "${!flag}" ]]; then
error "Missing required flag: -${flag:0:1} / --${flag,,}" error "Missing required flag: -${flag:0:1} / --${flag,,}"
exit 1 exit 1

View File

@ -548,15 +548,6 @@ function execInnerDockerNoTTY() {
fi 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() { function execInnerDockerWithRetry() {
local max_retries=5 local max_retries=5
local container_name=$1 local container_name=$1
@ -583,6 +574,15 @@ function execInnerDockerWithRetry() {
return 0 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() { change_ubuntu_mirror_in_docker() {
local container_name=$1 local container_name=$1
local region=$2 local region=$2