KASM-7052 Add test-barebones

This commit is contained in:
Dmitry Maksyoma 2025-05-10 09:52:34 +00:00 committed by Matthew McClaskey
parent 0dbe6f9896
commit 0244c47d7a
29 changed files with 404 additions and 619 deletions

View File

@ -61,24 +61,80 @@ function prepare_upload_filename() {
fi
};
list_files_in_directory() {
local dir="$1"
find "$1" -mindepth 1
}
upload_directory_to_s3() {
local dir_to_upload="$1"
local s3_directory="$2";
local s3_bucket="$3";
for file_to_upload in $(list_files_in_directory "$dir_to_upload"); do
upload_to_s3 "$file_to_upload" "$s3_directory/$file_to_upload" "$s3_bucket"
done
}
prepare_functional_tests_source_and_cd_into_it() {
git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/kasm-technologies/internal/kasmvnc-functional-tests.git
cd kasmvnc-functional-tests
mkdir output && chown 1000:1000 output
mkdir report && chown 1000:1000 report
}
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() {
report_name="Functional%20test%20report"
report_url="https://${S3_BUCKET}.s3.amazonaws.com/${s3_tests_directory}/report/index.html"
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${report_name}&target_url=${report_url}"
}
prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages() {
cp -r ../output/jammy output/
}
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
}
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
}
function upload_to_s3() {
local package="$1";
local upload_filename="$2";
local file_to_upload="$1";
local s3_url_for_file="$2";
local s3_bucket="$3";
# Transfer to S3
python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${s3_bucket}" "$package" "${upload_filename}";
python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "$s3_bucket" "$file_to_upload" "$s3_url_for_file";
# Use the Gitlab API to tell Gitlab where the artifact was stored
export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${upload_filename}";
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 ruby2.7 git wget;
apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev;
git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git;
};
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y ruby2.7 git wget
apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev
prepare_s3_uploader
}
detect_release_branch() {
if echo $CI_COMMIT_REF_NAME | grep -Pq '^release/([\d.]+)$'; then

3
.gitignore vendored
View File

@ -29,6 +29,9 @@ debian/kasmvncserver/
.pc
.vscode/
# --run-test artifacts
run_test/
alpine/.abuild/kasmvnc_signing_key.rsa
alpine/.abuild/kasmvnc_signing_key.rsa.pub
alpine/packages/

View File

@ -22,6 +22,8 @@ workflow:
stages:
- www
- build
- functional_test
- run_test
- test
- upload
@ -42,6 +44,24 @@ default:
tags:
- oci-fixed-amd
functional_test:
stage: functional_test
image: debian:bookworm
tags:
- oci-fixed-amd
before_script:
- . .ci/upload.sh
script:
- prepare_to_run_functional_tests
- ./functional-test
- upload_report_to_s3
- put_report_into_ci_pipeline
dependencies:
- build_amd64
artifacts:
paths:
- kasmvnc-functional-tests/output/
build_www:
stage: www
allow_failure: false
@ -67,7 +87,7 @@ build_www:
paths:
- output/
build_ubuntu_focal:
build_amd64:
stage: build
allow_failure: true
tags:
@ -78,15 +98,18 @@ build_ubuntu_focal:
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu focal;
- bash builder/build-package $DISTRO;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO"
artifacts:
paths:
- output/
parallel:
matrix:
- DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ]
build_ubuntu_focal_arm:
build_arm64:
stage: build
allow_failure: true
tags:
@ -97,435 +120,60 @@ build_ubuntu_focal_arm:
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu focal;
- bash builder/build-package $DISTRO;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO"
artifacts:
paths:
- output/
parallel:
matrix:
- DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ]
build_ubuntu_jammy:
stage: build
allow_failure: true
run_test_amd64:
stage: run_test
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu jammy;
- bash builder/test-barebones --run-test $DISTRO
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO"
dependencies:
- build_amd64
artifacts:
paths:
- output/
reports:
junit:
- run_test/*.xml
parallel:
matrix:
- DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ]
build_ubuntu_jammy_arm:
stage: build
allow_failure: true
run_test_arm64:
stage: run_test
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu jammy;
- bash builder/test-barebones --run-test $DISTRO
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO"
dependencies:
- build_arm64
artifacts:
paths:
- output/
reports:
junit:
- run_test/*.xml
parallel:
matrix:
- DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ]
build_ubuntu_noble:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu noble;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_ubuntu_noble_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package ubuntu noble;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bullseye:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bullseye;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bullseye_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bullseye;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bookworm:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bookworm;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_debian_bookworm_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package debian bookworm;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_kali_rolling:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package kali kali-rolling;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_kali_rolling_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package kali kali-rolling;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_8:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 8;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_8_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 8;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_9:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 9;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_9_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 9;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_opensuse_15:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package opensuse 15;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_opensuse_15_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package opensuse 15;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_thirtynine:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora thirtynine;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_thirtynine_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora thirtynine;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_forty:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora forty;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_forty_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora forty;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_fortyone:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora fortyone;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_fortyone_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora fortyone;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
test:
spec_test:
stage: test
tags:
- kasmvnc-x86
@ -540,158 +188,6 @@ test:
- bash builder/test-vncserver
build_alpine_318:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 318;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_318_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 318;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_319:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 319;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_319_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 319;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_320:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 320;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_320_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 320;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_321:
stage: build
allow_failure: true
tags:
- oci-fixed-amd
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 321;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_321_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 321;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
upload:
stage: upload
image: ubuntu:focal

View File

@ -6,14 +6,7 @@ os="$1"
codename="$2"
build_tag="$3"
detect_package_format() {
package_format=rpm
if ls builder/dockerfile*"$os"* | grep -q .deb.build; then
package_format=deb
elif ls builder/dockerfile*"$os"* | grep -q .apk.build; then
package_format=apk
fi
}
. ./builder/common.sh
warn_build_tag_not_supported_for_rpm_and_exit() {
if [[ "$build_tag" && "$package_format" = "rpm" ]]; then

View File

@ -1 +1,24 @@
VNC_PORT=8443
detect_build_dir() {
if [ -n "$CI" ]; then
build_dir=output
else
build_dir=builder/build
fi
}
detect_interactive() {
if [ -z "$run_test" ]; then
interactive=-it
fi
}
detect_package_format() {
package_format=rpm
if ls builder/dockerfile*"$os"* | grep -q .deb.build; then
package_format=deb
elif ls builder/dockerfile*"$os"* | grep -q .apk.build; then
package_format=apk
fi
}

View File

@ -0,0 +1,24 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN apk add bash
ENV STARTUPDIR=/dockerstartup
COPY ./builder/scripts/ /tmp/scripts/
COPY alpine/kasmvncserver/APKBUILD /tmp
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.apk /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
ARG RUN_TEST
RUN [ "$RUN_TEST" = 1 ] || apk add xterm
RUN mkdir -p $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN adduser -D -s/bin/bash foo && addgroup foo kasmvnc-cert
USER foo
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1 @@
dockerfile.alpine.barebones.apk.test

View File

@ -0,0 +1 @@
dockerfile.alpine.barebones.apk.test

View File

@ -0,0 +1 @@
dockerfile.alpine.barebones.apk.test

View File

@ -0,0 +1 @@
dockerfile.alpine.barebones.apk.test

View File

@ -0,0 +1,22 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE
ENV STARTUPDIR=/dockerstartup
COPY ./builder/scripts/ /tmp/scripts/
COPY ./debian/changelog /tmp
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
ARG RUN_TEST
RUN if [ "$RUN_TEST" != 1 ]; then apt-get update && apt-get -y install xterm lsb-release; fi
RUN mkdir -p $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo && adduser foo ssl-cert
USER foo
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -0,0 +1,25 @@
FROM fedora:40
ENV STARTUPDIR=/dockerstartup
ARG RUN_TEST
RUN [ "$RUN_TEST" = 1 ] || dnf install -y \
less \
redhat-lsb-core \
vim \
xterm
COPY ./builder/scripts/ /tmp/scripts/
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/
COPY fedora/kasmvncserver.spec /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
RUN mkdir -p $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1,25 @@
FROM fedora:41
ENV STARTUPDIR=/dockerstartup
ARG RUN_TEST
RUN [ "$RUN_TEST" = 1 ] || dnf install -y \
less \
redhat-lsb-core \
vim \
xterm
COPY ./builder/scripts/ /tmp/scripts/
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/
COPY fedora/kasmvncserver.spec /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
RUN mkdir -p $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -3,7 +3,8 @@ FROM opensuse/leap:15.5
ENV STARTUPDIR=/dockerstartup
# base tools
RUN zypper -n install -y \
ARG RUN_TEST
RUN [ "$RUN_TEST" = 1 ] || zypper -n install -y \
less \
vim \
xterm
@ -15,7 +16,7 @@ COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN zypper install -y --allow-unsigned-rpm /tmp/*.rpm
RUN mkdir -p $STARTUPDIR
COPY startup/vnc_startup_barebones.sh $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert

View File

@ -2,7 +2,8 @@ FROM oraclelinux:8
ENV STARTUPDIR=/dockerstartup
RUN dnf install -y \
ARG RUN_TEST
RUN [ "$RUN_TEST" = 1 ] || dnf install -y \
less \
redhat-lsb-core \
vim \
@ -10,12 +11,15 @@ RUN dnf install -y \
RUN dnf config-manager --set-enabled ol8_codeready_builder
RUN dnf install -y oracle-epel-release-el8
COPY ./builder/scripts/ /tmp/scripts/
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN dnf localinstall -y /tmp/*.rpm
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/
COPY fedora/kasmvncserver.spec /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
RUN mkdir -p $STARTUPDIR
COPY startup/vnc_startup_barebones.sh $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert

View File

@ -2,7 +2,7 @@ FROM oraclelinux:9
ENV STARTUPDIR=/dockerstartup
RUN dnf install -y \
RUN [ "$RUN_TEST" = 1 ] || dnf install -y \
less \
vim \
xterm
@ -17,7 +17,7 @@ RUN dnf install -y crypto-policies-scripts
RUN update-crypto-policies --set FIPS:SHA1
RUN mkdir -p $STARTUPDIR
COPY startup/vnc_startup_barebones.sh $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert

View File

@ -1,20 +0,0 @@
FROM ubuntu:focal
ENV STARTUPDIR=/dockerstartup
COPY ./builder/scripts/ /tmp/scripts/
COPY ./debian/changelog /tmp
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
RUN /tmp/scripts/install_kasmvncserver_package
RUN apt-get update && apt-get -y install xterm lsb-release
RUN mkdir -p $STARTUPDIR
COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo && addgroup foo ssl-cert
USER foo
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -0,0 +1 @@
dockerfile.debian.barebones.deb.test

View File

@ -6,7 +6,7 @@ usage() {
}
process_options() {
local sorted_options=$(getopt -o psh --long perf-test --long shell --long help -- "$@")
local sorted_options=$(getopt -o prsh --long perf-test --long run-test --long shell --long help -- "$@")
eval set -- $sorted_options
while : ; do
@ -16,6 +16,10 @@ process_options() {
entrypoint_executable="--entrypoint=/usr/bin/Xvnc"
shift
;;
-r|--run-test)
run_test=1
shift
;;
-s|--shell)
entrypoint_executable="--entrypoint=bash"
shift

View File

@ -10,6 +10,10 @@ is_debian() {
[[ -f /etc/debian_version ]]
}
is_alpine() {
[[ -f /etc/alpine-release ]]
}
check_package_version_exists() {
if ! stat /tmp/kasmvncserver_"$package_version"*.deb; then
>&2 echo "No package found for version $package_version"
@ -42,7 +46,16 @@ install_package_built_for_current_branch_package_version_deb() {
--file /tmp/changelog)
check_package_version_exists
apt-get install -y /tmp/kasmvncserver_"$package_version"*"$tag"*.deb
dpkg_arch=$(dpkg-architecture -q DEB_BUILD_ARCH)
apt-get install -y /tmp/kasmvncserver_"$package_version"*"$tag"*_${dpkg_arch}.deb
}
detect_dnf_command() {
if command -v dnf5 >/dev/null; then
echo dnf install -y --allowerasing
else
echo dnf localinstall -y --allowerasing
fi
}
install_package_built_for_current_branch_package_version_rpm() {
@ -50,15 +63,24 @@ install_package_built_for_current_branch_package_version_rpm() {
$rpm_package_manager install -y rpmdevtools
package_version=$(rpmspec -q --qf '%{version}\n' /tmp/kasmvncserver.spec 2>/dev/null)
package_name=/tmp/kasmvncserver-"$package_version"*.$(arch).rpm
if [[ $rpm_package_manager = "dnf" ]]; then
dnf localinstall -y --allowerasing /tmp/kasmvncserver-"$package_version"*.rpm
local dnf_cmd=$(detect_dnf_command)
$dnf_cmd $package_name
else
yum install -y /tmp/kasmvncserver-"$package_version"*.rpm
yum install -y $package_name
fi
}
install_package_built_for_current_branch_package_version_apk() {
package_version=$(sed -n 's/pkgver=\(.\+\)/\1/p' /tmp/APKBUILD )
apk add /tmp/kasmvncserver-"$package_version"*.apk /tmp/kasmvncserver-doc-"$package_version"*.apk --allow-untrusted
}
if is_debian ; then
install_package_built_for_current_branch_package_version_deb
elif is_alpine; then
install_package_built_for_current_branch_package_version_apk
else
install_package_built_for_current_branch_package_version_rpm
fi

View File

@ -19,4 +19,9 @@ set_xterm_to_run
create_kasm_user
vncserver -select-de manual -websocketPort "$VNC_PORT"
vncserver_exit_code=$?
if [ "$RUN_TEST" = 1 ]; then
exit "$vncserver_exit_code"
fi
tail -f "$config_dir"/*.log

30
builder/test-apk-barebones Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -e
detect_base_image() {
BASE_IMAGE=$(echo "${os}:${os_codename}" | sed 's/\([0-9]\{2\}\)$/.\1/')
}
cd "$(dirname "$0")/.."
. ./builder/process_test_options.sh
. ./builder/common.sh
os="${1:-alpine}"
os_codename="${2:-321}"
detect_build_dir
detect_base_image
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${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.apk.test .
echo
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args

42
builder/test-barebones Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
set -eo pipefail
create_gitlab_report() {
local error="$1"
failure_report=$(cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Run test" tests="1" failures="1" errors="0" skipped="0">
<testcase classname="$os_fullname" name="Test run">
<failure type="description">${error}</failure>
</testcase>
</testsuite>
EOF
)
}
write_gitlab_report() {
echo "$failure_report" > run_test/"${os}_${os_codename}.xml"
}
saved_options=("$@")
. ./builder/process_test_options.sh
. ./builder/common.sh
os="$1"
os_codename="$2"
os_fullname="${os}_${os_codename}"
detect_package_format
if [ "$run_test" != 1 ]; then
builder/test-${package_format}-barebones "${saved_options[@]}"
exit $?
fi
mkdir -p run_test
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)"
write_gitlab_report
exit 1
fi

View File

@ -2,18 +2,33 @@
set -e
detect_base_image() {
if [ "$os" = kali ]; then
BASE_IMAGE=kalilinux/kali-rolling:latest
return
fi
BASE_IMAGE="${os}:${os_codename}"
}
cd "$(dirname "$0")/.."
. ./builder/process_test_options.sh
. ./builder/common.sh
os="${1:-debian}"
os_codename="${2:-buster}"
docker build --build-arg KASMVNC_PACKAGE_DIR="builder/build/${os_codename}" \
detect_build_dir
detect_base_image
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 .
echo
docker run -it -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args

View File

@ -2,17 +2,22 @@
set -e
cd "$(dirname "$0")"
. ./process_test_options.sh
. ./common.sh
cd "$(dirname "$0")/.."
. ./builder/process_test_options.sh
. ./builder/common.sh
os="${1:-oracle}"
os_codename="${2:-8}"
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os}_${os_codename}" \
detect_build_dir
docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \
--build-arg RUN_TEST="$run_test" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.barebones.rpm.test .
docker run -it -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
-f builder/dockerfile.${os}_${os_codename}.barebones.rpm.test .
detect_interactive
docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \
-e "VNC_PORT=$VNC_PORT" \
-e RUN_TEST="$run_test" \
$entrypoint_executable \
kasmvnctester_barebones_${os}:$os_codename \
$entrypoint_args