diff --git a/Dockerfile b/Dockerfile index f667a53..d4c88d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,15 +20,18 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,graphics,video,utility" # Container setup RUN \ echo "**** install packages ****" && \ - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ - echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu noble stable" > \ - /etc/apt/sources.list.d/docker.list && \ + install -m 0755 -d /etc/apt/keyrings && \ + curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \ + chmod a+r /etc/apt/keyrings/docker.asc && \ + printf "Types: deb\nURIs: https://download.docker.com/linux/ubuntu\nSuites: $(. /etc/os-release && echo ${UBUNTU_CODENAME:-$VERSION_CODENAME})\nComponents: stable\nArchitectures: $(dpkg --print-architecture)\nSigned-By: /etc/apt/keyrings/docker.asc" > /etc/apt/sources.list.d/docker.sources && \ + cat /etc/apt/sources.list.d/docker.sources && \ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ printf "Package: docker-ce docker-ce-cli docker-ce-rootless-extras\nPin: version 5:29.* \nPin-Priority: 1001" > /etc/apt/preferences.d/docker && \ + apt-get update && \ apt-get install -y --no-install-recommends \ btrfs-progs \ build-essential \ @@ -54,7 +57,7 @@ RUN \ usermod -G dockremap dockremap && \ echo 'dockremap:165536:65536' >> /etc/subuid && \ echo 'dockremap:165536:65536' >> /etc/subgid && \ - curl -o \ + curl -w "%{response_code}" -o \ /usr/local/bin/dind -L \ https://raw.githubusercontent.com/moby/moby/master/hack/dind && \ chmod +x /usr/local/bin/dind && \ @@ -69,22 +72,12 @@ RUN \ curl -o \ /tmp/wizard.tar.gz -L \ # "https://github.com/kasmtech/kasm-install-wizard/archive/refs/tags/${KASM_VERSION}.tar.gz" && \ - "https://github.com/kasmtech/kasm-install-wizard/archive/refs/tags/1.18.0.tar.gz" && \ + "https://github.com/KodeStar/kasm-install-wizard/archive/refs/heads/feature/KASM-8264-registry-based-wizard-installer.tar.gz" && \ tar xf \ /tmp/wizard.tar.gz -C \ /wizard --strip-components=1 && \ - # Enable rolling service images - sed -i "/installFlags = \[.*/a \ installFlags.push('-O');" /wizard/index.js && \ cd /wizard && \ npm install && \ - echo "**** add image definitions ****" && \ - curl -o \ - /tmp/images.tar.gz -L \ - #"https://kasm-ci.s3.amazonaws.com/${KASM_VERSION}-images-combined.tar.gz" && \ - "https://kasm-ci.s3.amazonaws.com/1.18.0-images-combined.tar.gz" && \ - tar xf \ - /tmp/images.tar.gz -C \ - / && \ echo "**** add installer ****" && \ curl -o \ /tmp/kasm.tar.gz -L \ @@ -92,17 +85,9 @@ RUN \ tar xf \ /tmp/kasm.tar.gz -C \ / && \ - ALVERSION=$(cat /kasm_release/conf/database/seed_data/default_properties.yaml |awk '/alembic_version/ {print $2}') && \ - sed -i \ - '/alembic_version/s/.*/alembic_version: '${ALVERSION}'/' \ - /kasm_release/conf/database/seed_data/default_images_a* && \ # Don't check for open ports sed -i 's/-N -e -H/-N -B -e -H/g' /kasm_release/upgrade.sh && \ echo "exit 0" > /kasm_release/install_dependencies.sh && \ - # Add our customisations - /kasm_release/bin/utils/yq_$(uname -m) -i \ - '.services.proxy.volumes += "/kasm_release/www/img/thumbnails:/srv/www/img/thumbnails"' \ - /kasm_release/docker/docker-compose-all.yaml && \ /kasm_release/bin/utils/yq_$(uname -m) -i \ '.services.proxy.depends_on = {"kasm_manager":{"condition": "service_healthy"},"kasm_api":{"condition": "service_healthy"},"kasm_agent":{"condition": "service_started"},"kasm_guac":{"condition": "service_started"}}' \ /kasm_release/docker/docker-compose-all.yaml && \ @@ -118,13 +103,6 @@ RUN \ /kasm_release/bin/utils/yq_$(uname -m) -i \ '.services.kasm_rdp_https_gateway.depends_on = {"proxy":{"condition": "service_started"}}' \ /kasm_release/docker/docker-compose-all.yaml && \ - echo "**** copy assets ****" && \ - cp \ - /kasm_release/www/img/thumbnails/*.png /kasm_release/www/img/thumbnails/*.svg \ - /wizard/public/img/thumbnails/ && \ - cp \ - /kasm_release/conf/database/seed_data/default_images_a* \ - /wizard/ && \ useradd -u 70 kasm_db && \ useradd kasm && \ printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ diff --git a/Jenkinsfile b/Jenkinsfile index a197639..2f37b85 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,7 +30,7 @@ pipeline { PR_DOCKERHUB_IMAGE = 'lspipepr/kasm' DIST_IMAGE = 'ubuntu' MULTIARCH='true' - CI='true' + CI='false' CI_WEB='false' CI_PORT='3000' CI_SSL='true' @@ -77,6 +77,7 @@ pipeline { ''' script{ env.EXIT_STATUS = '' + env.CI_TEST_ATTEMPTED = '' env.LS_RELEASE = sh( script: '''docker run --rm quay.io/skopeo/stable:v1 inspect docker://ghcr.io/${LS_USER}/${CONTAINER_NAME}:latest 2>/dev/null | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''', returnStdout: true).trim() @@ -839,6 +840,7 @@ pipeline { script{ env.CI_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/index.html' env.CI_JSON_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/report.json' + env.CI_TEST_ATTEMPTED = 'true' } sh '''#! /bin/bash set -e @@ -1041,98 +1043,13 @@ EOF ) ''' } } - // If this is a Pull request send the CI link as a comment on it - stage('Pull Request Comment') { - when { - not {environment name: 'CHANGE_ID', value: ''} - environment name: 'EXIT_STATUS', value: '' - } - steps { - sh '''#! /bin/bash - # Function to retrieve JSON data from URL - get_json() { - local url="$1" - local response=$(curl -s "$url") - if [ $? -ne 0 ]; then - echo "Failed to retrieve JSON data from $url" - return 1 - fi - local json=$(echo "$response" | jq .) - if [ $? -ne 0 ]; then - echo "Failed to parse JSON data from $url" - return 1 - fi - echo "$json" - } - - build_table() { - local data="$1" - - # Get the keys in the JSON data - local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]') - - # Check if keys are empty - if [ -z "$keys" ]; then - echo "JSON report data does not contain any keys or the report does not exist." - return 1 - fi - - # Build table header - local header="| Tag | Passed |\\n| --- | --- |\\n" - - # Loop through the JSON data to build the table rows - local rows="" - for build in $keys; do - local status=$(echo "$data" | jq -r ".[\\"$build\\"].test_success") - if [ "$status" = "true" ]; then - status="✅" - else - status="❌" - fi - local row="| "$build" | "$status" |\\n" - rows="${rows}${row}" - done - - local table="${header}${rows}" - local escaped_table=$(echo "$table" | sed 's/\"/\\\\"/g') - echo "$escaped_table" - } - - if [[ "${CI}" = "true" ]]; then - # Retrieve JSON data from URL - data=$(get_json "$CI_JSON_URL") - # Create table from JSON data - table=$(build_table "$data") - echo -e "$table" - - curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \ - -d "{\\"body\\": \\"I am a bot, here are the test results for this PR: \\n${CI_URL}\\n${SHELLCHECK_URL}\\n${table}\\"}" - else - curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \ - -d "{\\"body\\": \\"I am a bot, here is the pushed image/manifest for this PR: \\n\\n\\`${GITHUBIMAGE}:${META_TAG}\\`\\"}" - fi - ''' - - } - } } /* ###################### - Send status to Discord + Comment on PR and Send status to Discord ###################### */ post { always { - sh '''#!/bin/bash - rm -rf /config/.ssh/id_sign - rm -rf /config/.ssh/id_sign.pub - git config --global --unset gpg.format - git config --global --unset user.signingkey - git config --global --unset commit.gpgsign - ''' - script{ + script { env.JOB_DATE = sh( script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''', returnStdout: true).trim() @@ -1175,6 +1092,87 @@ EOF "username": "Jenkins"}' ${BUILDS_DISCORD} ''' } } + script { + if (env.GITHUBIMAGE =~ /lspipepr/){ + if (env.CI_TEST_ATTEMPTED == "true"){ + sh '''#! /bin/bash + # Function to retrieve JSON data from URL + get_json() { + local url="$1" + local response=$(curl -s "$url") + if [ $? -ne 0 ]; then + echo "Failed to retrieve JSON data from $url" + return 1 + fi + local json=$(echo "$response" | jq .) + if [ $? -ne 0 ]; then + echo "Failed to parse JSON data from $url" + return 1 + fi + echo "$json" + } + + build_table() { + local data="$1" + + # Get the keys in the JSON data + local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]') + + # Check if keys are empty + if [ -z "$keys" ]; then + echo "JSON report data does not contain any keys or the report does not exist." + return 1 + fi + + # Build table header + local header="| Tag | Passed |\\n| --- | --- |\\n" + + # Loop through the JSON data to build the table rows + local rows="" + for build in $keys; do + local status=$(echo "$data" | jq -r ".[\\"$build\\"].test_success") + if [ "$status" = "true" ]; then + status="✅" + else + status="❌" + fi + local row="| "$build" | "$status" |\\n" + rows="${rows}${row}" + done + + local table="${header}${rows}" + local escaped_table=$(echo "$table" | sed 's/\"/\\\\"/g') + echo "$escaped_table" + } + + if [[ "${CI}" = "true" ]]; then + # Retrieve JSON data from URL + data=$(get_json "$CI_JSON_URL") + # Create table from JSON data + table=$(build_table "$data") + echo -e "$table" + + curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \ + -d "{\\"body\\": \\"I am a bot, here are the test results for this PR: \\n${CI_URL}\\n${SHELLCHECK_URL}\\n${table}\\"}" + else + curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \ + -d "{\\"body\\": \\"I am a bot, here is the pushed image/manifest for this PR: \\n\\n\\`${GITHUBIMAGE}:${META_TAG}\\`\\"}" + fi + ''' + } + } + } + sh '''#!/bin/bash + rm -rf /config/.ssh/id_sign + rm -rf /config/.ssh/id_sign.pub + git config --global --unset gpg.format + git config --global --unset user.signingkey + git config --global --unset commit.gpgsign + ''' } cleanup { sh '''#! /bin/bash diff --git a/README.md b/README.md index f272234..84f6caa 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ Find us at: [![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/kasm.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/linuxserver/kasm) [![Docker Stars](https://img.shields.io/docker/stars/linuxserver/kasm.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/linuxserver/kasm) [![Jenkins Build](https://img.shields.io/jenkins/build?labelColor=555555&logoColor=ffffff&style=for-the-badge&jobUrl=https%3A%2F%2Fci.linuxserver.io%2Fjob%2FDocker-Pipeline-Builders%2Fjob%2Fdocker-kasm%2Fjob%2Fmaster%2F&logo=jenkins)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-kasm/job/master/) -[![LSIO CI](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=CI&query=CI&url=https%3A%2F%2Fci-tests.linuxserver.io%2Flinuxserver%2Fkasm%2Flatest%2Fci-status.yml)](https://ci-tests.linuxserver.io/linuxserver/kasm/latest/index.html) [Kasm](https://www.kasmweb.com/?utm_campaign=LinuxServer&utm_source=listing) Workspaces is a docker container streaming platform for delivering browser-based access to desktops, applications, and web services. Kasm uses devops-enabled Containerized Desktop Infrastructure (CDI) to create on-demand, disposable, docker containers that are accessible via web browser. Example use-cases include Remote Browser Isolation (RBI), Data Loss Prevention (DLP), Desktop as a Service (DaaS), Secure Remote Access Services (RAS), and Open Source Intelligence (OSINT) collections. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index a0bc19a..a6a7c8c 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -19,7 +19,7 @@ repo_vars: - PR_DOCKERHUB_IMAGE = 'lspipepr/kasm' - DIST_IMAGE = 'ubuntu' - MULTIARCH='true' - - CI='true' + - CI='false' - CI_WEB='false' - CI_PORT='3000' - CI_SSL='true'