Skip to content

Commit 9b56b75

Browse files
authored
Merge pull request #88 from thin-edge/fix-persist-container-plugin-data-by-default
fix: persist tedge-container-plugin data by default
2 parents 0120ca7 + 228e0af commit 9b56b75

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ ENV TEDGE_C8Y_PROXY_CLIENT_HOST=127.0.0.1
133133
ENV TEDGE_AGENT_STATE_PATH="$DATA_DIR/agent"
134134
ENV TEDGE_LOGS_PATH="$DATA_DIR/logs"
135135

136+
# ensure tedge-container-plugin data is stored in a persistent directory
137+
ENV CONTAINER_DATA_DIR="$DATA_DIR/tedge-container-plugin/data"
138+
ENV CONTAINER_REGISTRY_CREDENTIALS_PATH="$DATA_DIR/tedge-container-plugin/credentials.toml"
139+
136140
# Persist tedge.toml under /data/tedge/tedge.toml by using
137141
# a symlink from /etc/tedge/tedge.toml to /data/tedge/tedge.toml
138142
# This allows the tedge.toml to be maintained across updates

tests/main/self-update.robot

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,16 @@ Rollback when trying to install a non-tedge based image
6363

6464
Self update using software update operation using Container type
6565
# Change a tedge.toml value to see if it is persisted
66-
Execute Command cmd=podman exec tedge test -L /etc/tedge/tedge.toml || docker exec tedge test -L /etc/tedge/tedge.toml timeout=30
66+
Execute Command
67+
... cmd=podman exec tedge test -L /etc/tedge/tedge.toml || docker exec tedge test -L /etc/tedge/tedge.toml
68+
... timeout=30
6769
${operation}= Execute Shell Command tedge config set c8y.availability.interval 61m
6870
Operation Should Be SUCCESSFUL ${operation}
69-
71+
72+
# Add some data in the container data dir
73+
${operation}= Execute Shell Command mkdir -p "$CONTAINER_DATA_DIR" && touch "$CONTAINER_DATA_DIR/foo"
74+
Operation Should Be SUCCESSFUL ${operation}
75+
7076
# pre-condition
7177
Device Should Have Installed Software
7278
... {"name": "tedge", "version": "ghcr.io/thin-edge/tedge-container-bundle:99.99.1", "softwareType": "container"}
@@ -86,3 +92,7 @@ Self update using software update operation using Container type
8692
${operation}= Execute Shell Command tedge config get c8y.availability.interval 2>/dev/null
8793
${operation}= Operation Should Be SUCCESSFUL ${operation}
8894
Should Be Equal As Strings ${operation["c8y_Command"]["result"]} 61m${\n}
95+
96+
# check if the file still exists
97+
${operation}= Execute Shell Command test -f "$CONTAINER_DATA_DIR/foo"
98+
${operation}= Operation Should Be SUCCESSFUL ${operation}

0 commit comments

Comments
 (0)