Skip to content

Commit

Permalink
feat: update to drawio-desktop 24.4.8 (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse authored Jun 1, 2024
1 parent c336f34 commit b9817ac
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:bookworm
ARG TARGETARCH

WORKDIR "/opt/drawio-desktop"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
25 changes: 23 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -44,14 +44,15 @@ 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]
...
----
<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]
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/unwanted-security-warnings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Floss manager not present
Init observer found at shutdown
InitializeSandbox
extension not supported
AttributionReportingCrossAppWeb cannot be enabled in this configuration
7 changes: 5 additions & 2 deletions tests/base.bats
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bats

docker_test() {
# Get parameters
local docker_opts=$1
local status=$2
local output_file=$3
Expand All @@ -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")" = "" ]
Expand Down
1 change: 1 addition & 0 deletions tests/expected/uniq-output-electron-security-warning.log
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/export.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit b9817ac

Please sign in to comment.