diff --git a/Dockerfile b/Dockerfile index 3b942a5..11eac93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bookworm ARG TARGETARCH WORKDIR "/opt/drawio-desktop" @@ -12,7 +12,7 @@ apt-get update apt-get install -y xvfb wget libgbm1 libasound2 # Drawio Desktop -DRAWIO_VERSION="24.4.0" +DRAWIO_VERSION="24.4.8" wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb apt-get install -y /opt/drawio-desktop/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb rm -rf /opt/drawio-desktop/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb diff --git a/Makefile b/Makefile index a8ca6b5..b9c30d2 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ test-ci-setup: test-ci: @mkdir -p tests/output - @DOCKER_IMAGE=$(DOCKER_IMAGE) npx bats -r tests + @DOCKER_IMAGE=$(DOCKER_IMAGE) npx bats --verbose-run -r tests autoupdate-drawio-desktop: @$(eval DRAWIO_DESKTOP_RELEASE := $(shell gh release list --repo jgraph/drawio-desktop | grep "Latest" | cut -f1)) diff --git a/README.adoc b/README.adoc index f2e0b19..35a0089 100644 --- a/README.adoc +++ b/README.adoc @@ -1,6 +1,6 @@ = Draw.io Desktop Headless docker image -Dockerized headless version of https://github.com/jgraph/drawio-desktop[Draw.io Desktop v24.4.0] +Dockerized headless version of https://github.com/jgraph/drawio-desktop[Draw.io Desktop v24.4.8] == What it does @@ -44,6 +44,7 @@ Usage: drawio [options] [input file/folder] $ docker run -it \ -u $(id -u):$(id -g) \ <1> -e HOME=/data/home -w /data \ <2> + -v /etc/passwd:/etc/passwd \ <3> -v $(pwd):/data rlespinasse/drawio-desktop-headless Usage: drawio [options] [input file/folder] ... @@ -51,7 +52,7 @@ Usage: drawio [options] [input file/folder] <1> Enable non-root user <2> env HOME need to contains the path of the working directory (can be the same) + -.If env HOME is not set properly +.What if env HOME is not set properly? [%collapsible] ==== [,console] @@ -73,6 +74,26 @@ Error: Failed to get 'userData' path /opt/drawio-desktop/runner.sh: line 4: 15 Trace/breakpoint trap (core dumped) "${DRAWIO_DESKTOP_EXECUTABLE_PATH:?}" "$@" --no-sandbox --disable-gpu ---- ==== +<3> Needed to run drawio as non-root since v24.4.6 ++ +.What if this volume is not set properly? +[%collapsible] +==== +[,console] +---- +A JavaScript error occurred in the main process +Uncaught Exception: +SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory) + at new SystemError (node:internal/errors:259:5) + at new NodeError (node:internal/errors:370:7) + at Object.userInfo (node:os:365:11) + at file:///opt/drawio/resources/app.asar/node_modules/atomically/dist/constants.js:10:29 + at ModuleJob.run (node:internal/modules/esm/module_job:218:25) + at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) + at async node:electron/js2c/browser_init:2:125628 + at async loadESM (node:internal/process/esm_loader:28:7) +---- +==== === Configuration diff --git a/src/unwanted-security-warnings.txt b/src/unwanted-security-warnings.txt index 1182fa6..c906f53 100644 --- a/src/unwanted-security-warnings.txt +++ b/src/unwanted-security-warnings.txt @@ -5,3 +5,4 @@ Floss manager not present Init observer found at shutdown InitializeSandbox extension not supported +AttributionReportingCrossAppWeb cannot be enabled in this configuration diff --git a/tests/base.bats b/tests/base.bats index 1393613..ab0c622 100755 --- a/tests/base.bats +++ b/tests/base.bats @@ -1,6 +1,7 @@ #!/usr/bin/env bats docker_test() { + # Get parameters local docker_opts=$1 local status=$2 local output_file=$3 @@ -9,19 +10,21 @@ docker_test() { shift shift shift + + # Run command echo docker container run -t $docker_opts -w /data -v $(pwd)/${data_folder:-}:/data ${DOCKER_IMAGE} "$@" >>tests/output/$output_file-command.log run docker container run -t $docker_opts -w /data -v $(pwd)/${data_folder:-}:/data ${DOCKER_IMAGE} "$@" # Remove timed logging tags on electron logs by default. echo "$output" | tee "tests/output/$output_file.log" | sed 's#\[.*:.*/.*\..*:.*:.*\(.*\)\] ##' >"tests/output/$output_file-comp.log" + # Test status [ "$status" -eq $status ] + # Test output if [ -f "tests/expected/$output_file.log" ]; then diff -u --strip-trailing-cr "tests/output/$output_file-comp.log" "tests/expected/$output_file.log" >"tests/output/$output_file-diff.log" elif [ -f "tests/expected/uniq-$output_file.log" ]; then diff -u --strip-trailing-cr <(sort -u "tests/output/$output_file-comp.log") "tests/expected/uniq-$output_file.log" >"tests/output/$output_file-diff.log" - else - echo "No output test file at 'tests/expected/[uniq-]$output_file.log'" fi if [ -f "tests/output/$output_file-diff.log"]; then [ "$(cat "tests/output/$output_file-diff.log")" = "" ] diff --git a/tests/expected/uniq-output-electron-security-warning.log b/tests/expected/uniq-output-electron-security-warning.log index a76acf8..4edeae7 100644 --- a/tests/expected/uniq-output-electron-security-warning.log +++ b/tests/expected/uniq-output-electron-security-warning.log @@ -1,3 +1,4 @@ +AttributionReportingCrossAppWeb cannot be enabled in this configuration. Use --enable-features=ConversionMeasurement,AttributionReportingCrossAppWeb in addition. Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory Floss manager not present, cannot set Floss enable/disable. diff --git a/tests/export.bats b/tests/export.bats index 124161d..a646aa2 100755 --- a/tests/export.bats +++ b/tests/export.bats @@ -17,7 +17,7 @@ } @test "Export as non-root" { - docker_test "--user $(id --user):$(id --group) --env HOME=/data/home" 0 "export-non-root" "tests/data" -x file4.drawio + docker_test "--user $(id --user):$(id --group) -v /etc/passwd:/etc/passwd --env HOME=/data/home" 0 "export-non-root" "tests/data" -x file4.drawio } @test "Export using unknown argument" {