@task-handoff/node-agent 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/docker/entrypoint.sh +42 -0
- package/package.json +1 -1
- package/runtime-artifacts/{controlled-instance-runtime-0.0.15-linux-universal.manifest.json → controlled-instance-runtime-0.0.17-linux-universal.manifest.json} +2 -2
- package/runtime-artifacts/controlled-instance-runtime-0.0.17-linux-universal.tar.gz +0 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.17-linux-universal.tar.gz.sha256 +1 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.15-linux-universal.tar.gz +0 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.15-linux-universal.tar.gz.sha256 +0 -1
package/docker/entrypoint.sh
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
+
load_private_config() {
|
|
5
|
+
local config_path="/run/task-handoff/instance-private-config.json"
|
|
6
|
+
if [ ! -f "${config_path}" ]; then
|
|
7
|
+
echo "Managed instance private configuration is missing." >&2
|
|
8
|
+
exit 78
|
|
9
|
+
fi
|
|
10
|
+
while IFS=$'\t' read -r key encoded; do
|
|
11
|
+
if [[ ! "${key}" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
|
|
12
|
+
echo "Managed instance private configuration contains an invalid environment key." >&2
|
|
13
|
+
exit 78
|
|
14
|
+
fi
|
|
15
|
+
local value
|
|
16
|
+
value="$(printf '%s' "${encoded}" | base64 --decode)"
|
|
17
|
+
export "${key}=${value}"
|
|
18
|
+
done < <(node -e '
|
|
19
|
+
const fs = require("node:fs");
|
|
20
|
+
const value = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
21
|
+
if (value.version !== 1 || typeof value.instanceCredential !== "string" || !value.instanceCredential || !value.environment || typeof value.environment !== "object" || Array.isArray(value.environment)) process.exit(78);
|
|
22
|
+
const environment = { ...value.environment, TASK_HANDOFF_REGISTRATION_TOKEN: value.instanceCredential, TASK_HANDOFF_PRIVATE_CONFIG_LOADED: "1" };
|
|
23
|
+
for (const [key, item] of Object.entries(environment)) {
|
|
24
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || typeof item !== "string") process.exit(78);
|
|
25
|
+
process.stdout.write(`${key}\t${Buffer.from(item).toString("base64")}\n`);
|
|
26
|
+
}
|
|
27
|
+
' "${config_path}")
|
|
28
|
+
if [ "${TASK_HANDOFF_PRIVATE_CONFIG_LOADED:-}" != "1" ]; then
|
|
29
|
+
echo "Managed instance private configuration is invalid." >&2
|
|
30
|
+
exit 78
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if [ "$(id -u)" = "0" ] && [ "${TASK_HANDOFF_PRIVILEGE_DROPPED:-0}" != "1" ]; then
|
|
35
|
+
load_private_config
|
|
36
|
+
mkdir -p /data /home/agent
|
|
37
|
+
chown agent:agent /data /home/agent
|
|
38
|
+
if [ "${TASK_HANDOFF_WORKSPACE_MODE:-}" = "git-clone" ]; then
|
|
39
|
+
mkdir -p "${TASK_HANDOFF_WORKSPACE:-/workspace}"
|
|
40
|
+
chown agent:agent "${TASK_HANDOFF_WORKSPACE:-/workspace}"
|
|
41
|
+
fi
|
|
42
|
+
export TASK_HANDOFF_PRIVILEGE_DROPPED=1
|
|
43
|
+
exec sudo --preserve-env -u agent -- "$0" "$@"
|
|
44
|
+
fi
|
|
45
|
+
|
|
4
46
|
mkdir -p \
|
|
5
47
|
"${TASK_HANDOFF_DATA_DIR:-/data/task-handoff}" \
|
|
6
48
|
"${TASK_HANDOFF_APP_CATALOG_DIR:-/data/task-handoff/app-catalog}" \
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "@task-handoff/controlled-instance",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"platform": "linux",
|
|
5
5
|
"arch": "universal",
|
|
6
6
|
"formatVersion": 1,
|
|
7
7
|
"launcherAbi": 1,
|
|
8
8
|
"entrypoint": "dist/controlled-instance-cli.js",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "b224f916d32ea03a1911d6f559e959a36e3a090a11077c341ebe3e5a268473f3"
|
|
10
10
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1d676a10fd0fd77d43fbf220b2d4bd82873bdfa81068e2253cab5a71f478474e controlled-instance-runtime-0.0.17-linux-universal.tar.gz
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
af3d2ffb993c7e188d1eb6fafb00a49b6861879afc6c25cee0a46f5ea76ef1d2 controlled-instance-runtime-0.0.15-linux-universal.tar.gz
|