mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2026-01-23 02:14:29 +00:00
VNC-213 Add core dumps for Xvnc as CI artifacts
This commit is contained in:
parent
efb076cbc8
commit
c58e5ca504
7 changed files with 97 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue