new initcontainer

This commit is contained in:
2026-01-14 20:24:24 +01:00
parent 80a8a32ab7
commit 924bd8434a
+21 -18
View File
@@ -1964,7 +1964,7 @@ spec:
fsGroup: 1000 fsGroup: 1000
initContainers: initContainers:
- name: build-bookmarks-index - name: build-bookmarks-index
image: mikefarah/yq:4 image: ghcr.io/mikefarah/yq:4.44.3
securityContext: securityContext:
runAsUser: 1000 runAsUser: 1000
runAsGroup: 1000 runAsGroup: 1000
@@ -1972,34 +1972,37 @@ spec:
command: ["/bin/sh", "-c"] command: ["/bin/sh", "-c"]
args: args:
- | - |
set -e set -eux
which yq
yq --version
mkdir -p /app/assets mkdir -p /app/assets
# 1) Extract all bookmark links into JSON (raw fields) yq eval -o=json '
yq -o=json '
[ .pages[] as $p [ .pages[] as $p
| .columns[]? as $c | $p.columns[]? as $c
| $c.widgets[]? as $w | $c.widgets[]? as $w
| select($w.type == "bookmarks") | select($w.type == "bookmarks")
| $w.groups[]? as $g | $w.groups[]? as $g
| $g.links[]? | $g.links[]?
| select(.url != null and .url != "") | select(.url != null and .url != "")
| { | {
title: (.title // ""), "title": (.title // .url),
url: .url, "url": .url,
page: ($p.name // ""), "page": ($p.name // ""),
widget: ($w.title // ""), "widget": ($w.title // ""),
group: ($g.title // "") "group": ($g.title // "")
} }
] ] | unique_by(.url)
' /config/glance.yml \ ' /config/glance.yml > /app/assets/bookmarks.json
| yq -o=json '
map(.title = (if .title == "" then .url else .title end))
| unique_by(.url)
' - \
> /app/assets/bookmarks.json
echo "Bookmarks indexed: $(yq -r 'length' /app/assets/bookmarks.json)" echo "Bookmarks indexed: $(yq eval -r 'length' /app/assets/bookmarks.json)"
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: assets
mountPath: /app/assets
volumeMounts: volumeMounts:
- name: config - name: config
mountPath: /config mountPath: /config