Merge branch 'master' into release/1.4.0

This commit is contained in:
matt 2025-08-15 15:54:16 +00:00
commit 9121826614
No known key found for this signature in database
8 changed files with 119 additions and 20 deletions

View file

@ -85,7 +85,6 @@ prepare_functional_tests_source_and_cd_into_it() {
upload_report_to_s3() {
s3_tests_directory="kasmvnc/${CI_COMMIT_SHA}/tests"
upload_directory_to_s3 report "$s3_tests_directory" "$S3_BUCKET"
aws s3 cp report/index.html "s3://${S3_BUCKET}/${s3_tests_directory}/report/index.html" --metadata-directive REPLACE --content-type "text/html"
}
put_report_into_ci_pipeline() {
@ -106,15 +105,23 @@ prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages() {
prepare_to_run_functional_tests() {
install_packages_needed_for_functional_tests
prepare_functional_tests_source_and_cd_into_it
prepare_s3_uploader
prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages
heed_debug_variable_and_toggle_debug_in_functional_tests
}
heed_debug_variable_and_toggle_debug_in_functional_tests() {
if [ -z "$CI" ]; then
return
fi
if [ "$DEBUG" = "true" ]; then
export KASMVNC_FUNC_TESTS_DEBUG=1
fi
}
install_packages_needed_for_functional_tests() {
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y git tree curl docker.io awscli
apt-get install -y ruby3.1 wget
apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev
prepare_to_run_scripts_and_s3_uploads
apt-get install -y tree docker.io
}
is_build_this_distro() {
@ -128,21 +135,18 @@ function upload_to_s3() {
local s3_bucket="$3";
# Transfer to S3
python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "$s3_bucket" "$file_to_upload" "$s3_url_for_file";
aws s3 cp "$file_to_upload" \
"s3://${S3_BUCKET}/${s3_url_for_file}" \
--metadata-directive REPLACE \
--content-type "$(file --mime-type -b \"$file_to_upload\")"
# Use the Gitlab API to tell Gitlab where the artifact was stored
export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${s3_url_for_file}";
};
function prepare_s3_uploader() {
git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git
}
function prepare_to_run_scripts_and_s3_uploads() {
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y ruby3.1 git wget
apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev
prepare_s3_uploader
apt-get install -y ruby3.1 wget curl file awscli
}
detect_release_branch() {

View file

@ -3,6 +3,7 @@ services:
- docker:dind
variables:
DEBUG: true
KASMVNC_COMMIT_ID: $CI_COMMIT_SHA
GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared
GIT_SUBMODULE_STRATEGY: recursive
@ -46,6 +47,9 @@ stages:
- cp -r builder/build/* output/
- rm output/*.tar.gz
.enable_core_dumps: &enable_core_dumps
- echo core > /proc/sys/kernel/core_pattern
default:
tags:
- oci-fixed-amd
@ -68,6 +72,9 @@ functional_test:
artifacts:
paths:
- kasmvnc-functional-tests/output/
reports:
junit:
- kasmvnc-functional-tests/report/*.xml
build_www:
stage: www
@ -145,6 +152,7 @@ run_test_amd64:
- oci-fixed-amd
before_script:
- *prepare_build
- *enable_core_dumps
- . .ci/helpers.sh
script:
- set -e
@ -156,6 +164,9 @@ run_test_amd64:
dependencies:
- build_amd64
artifacts:
when: always
paths:
- run_test/core_dumps/*/core
reports:
junit:
- run_test/*.xml
@ -170,6 +181,7 @@ run_test_arm64:
- oci-fixed-arm
before_script:
- *prepare_build
- *enable_core_dumps
- . .ci/helpers.sh
script:
- set -e
@ -181,6 +193,10 @@ run_test_arm64:
dependencies:
- build_arm64
artifacts:
artifacts:
when: always
paths:
- run_test/core_dumps/*/core
reports:
junit:
- run_test/*.xml

View file

@ -1,4 +1,7 @@
VNC_PORT=8443
core_dumps_dir_inside_container="/core_dumps"
core_dumps_dir_on_host="run_test/core_dumps"
core_dumps_dir_volume_option="-v ${PWD}/${core_dumps_dir_on_host}:/${core_dumps_dir_inside_container}"
detect_build_dir() {
if [ -n "$CI" ]; then

View file

@ -12,14 +12,62 @@ create_kasm_user() {
echo -e "$VNC_PW\n$VNC_PW\n" | kasmvncpasswd -w -u "$VNC_USER"
}
wait_for_core_to_be_dumped() {
if [ "$vncserver_exit_code" -eq 0 ]; then
return
fi
local timeout=2
local elapsed=0
local interval=1
while [[ ! -f core && "$elapsed" -lt "$timeout" ]]; do
sleep $interval
elapsed=$(($elapsed + $interval))
done
}
copy_core_to_host() {
mkdir -p "$CORE_DUMP_DIR_INSIDE_CONTAINER"
cp core "$CORE_DUMP_DIR_INSIDE_CONTAINER"
}
allow_core_to_be_dumped() {
ulimit -c unlimited
cd "$HOME"
}
clean_up_old_core_dir() {
if [ -d "$CORE_DUMP_DIR_INSIDE_CONTAINER" ]; then
rm -r "$CORE_DUMP_DIR_INSIDE_CONTAINER"
fi
}
core_was_dumped() {
[ -f core ]
}
say_where_to_find_core_on_host() {
echo "Core dumped to $CORE_DUMP_DIR_ON_HOST"
}
config_dir="$HOME/.vnc"
xstartup="$config_dir/xstartup"
set_xterm_to_run
create_kasm_user
allow_core_to_be_dumped
clean_up_old_core_dir
set +e
vncserver -select-de manual -websocketPort "$VNC_PORT"
vncserver_exit_code=$?
set -e
wait_for_core_to_be_dumped
if core_was_dumped; then
copy_core_to_host
say_where_to_find_core_on_host
fi
if [ "$RUN_TEST" = 1 ]; then
exit "$vncserver_exit_code"
fi

View file

@ -11,20 +11,27 @@ cd "$(dirname "$0")/.."
. ./builder/common.sh
os="${1:-alpine}"
os_codename="${2:-321}"
distro="${os}_${os_codename}"
detect_build_dir
detect_base_image
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${distro}" \
--build-arg RUN_TEST="$run_test" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f builder/dockerfile.${os}_${os_codename}.barebones.apk.test .
-f builder/dockerfile.${distro}.barebones.apk.test .
echo
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
$core_dumps_dir_volume_option \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
-e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \
-e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \
--cap-add=SYS_PTRACE \
--cap-add=SYS_RESOURCE \
--ulimit core=-1 \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args

View file

@ -19,6 +19,13 @@ write_gitlab_report() {
echo "$failure_report" > run_test/"${os}_${os_codename}.xml"
}
create_core_dumps_dir_writeable_by_container() {
mkdir -p "$core_dumps_dir_on_host"
if [[ -n "$CI" && $(id -u) = 0 ]]; then
chown 1000:1000 "$core_dumps_dir_on_host"
fi
}
saved_options=("$@")
. ./builder/process_test_options.sh
. ./builder/common.sh
@ -33,7 +40,7 @@ if [ "$run_test" != 1 ]; then
exit $?
fi
mkdir -p run_test
create_core_dumps_dir_writeable_by_container
if ! builder/test-${package_format}-barebones "${saved_options[@]}" 2>&1 | \
tee run_test/"${os_fullname}.log"; then
create_gitlab_report "$(tail -1 run_test/${os_fullname}.log)"

View file

@ -15,6 +15,7 @@ cd "$(dirname "$0")/.."
. ./builder/common.sh
os="${1:-debian}"
os_codename="${2:-buster}"
distro="${os}_${os_codename}"
detect_build_dir
detect_base_image
@ -22,13 +23,19 @@ docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os_codename}" \
--build-arg RUN_TEST="$run_test" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f builder/dockerfile.${os}_${os_codename}.barebones.deb.test .
-f builder/dockerfile.${distro}.barebones.deb.test .
echo
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
$core_dumps_dir_volume_option \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
-e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \
-e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \
--cap-add=SYS_PTRACE \
--cap-add=SYS_RESOURCE \
--ulimit core=-1 \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args

View file

@ -7,17 +7,24 @@ cd "$(dirname "$0")/.."
. ./builder/common.sh
os="${1:-oracle}"
os_codename="${2:-8}"
distro="${os}_${os_codename}"
detect_build_dir
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${distro}" \
--build-arg RUN_TEST="$run_test" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f builder/dockerfile.${os}_${os_codename}.barebones.rpm.test .
-f builder/dockerfile.${distro}.barebones.rpm.test .
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
$core_dumps_dir_volume_option \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
-e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \
-e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \
--cap-add=SYS_PTRACE \
--cap-add=SYS_RESOURCE \
--ulimit core=-1 \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args