@task-handoff/node-agent 0.0.37 → 0.0.38

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.
@@ -13,6 +13,13 @@ fail() {
13
13
  exit "${2:-1}"
14
14
  }
15
15
 
16
+ # Stage markers are the machine-readable progress contract consumed by the node
17
+ # agent. They are printed before the work they describe so a failing stage is
18
+ # reported even when the underlying command produces no output.
19
+ stage() {
20
+ printf 'TASK_HANDOFF_GIT_PROVISIONING_STAGE=%s\n' "$1"
21
+ }
22
+
16
23
  agent_pids=()
17
24
  cleanup() {
18
25
  for agent_pid in "${agent_pids[@]}"; do kill "${agent_pid}" 2>/dev/null || true; done
@@ -86,7 +93,9 @@ git_config=(
86
93
  # Only the TASK_HANDOFF_WORKSPACE_GIT_* keys are provisioning input: released
87
94
  # images bake TASK_HANDOFF_GIT_COMMIT as the image build commit and docker run
88
95
  # exposes image environment here, so the legacy keys must never be read.
89
- clone_args=(clone)
96
+ # --progress forces git to report transfer progress even though the provisioning
97
+ # container has no TTY. It must stay before the "--" separator.
98
+ clone_args=(clone --progress)
90
99
  # A commit SHA is not guaranteed to be reachable from a shallow default-branch clone.
91
100
  if [ -n "${TASK_HANDOFF_WORKSPACE_GIT_DEPTH:-}" ] && [ -z "${TASK_HANDOFF_WORKSPACE_GIT_COMMIT:-}" ]; then clone_args+=(--depth "${TASK_HANDOFF_WORKSPACE_GIT_DEPTH}"); fi
92
101
  if [ -n "${TASK_HANDOFF_WORKSPACE_GIT_REF:-}" ]; then clone_args+=(--branch "${TASK_HANDOFF_WORKSPACE_GIT_REF}"); fi
@@ -95,6 +104,7 @@ clone_args+=(-- "${TASK_HANDOFF_WORKSPACE_GIT_URL}" "${checkout}")
95
104
  mkdir -p /tmp/task-handoff-git-home
96
105
  chown 1000:1000 /tmp/task-handoff-git-home
97
106
 
107
+ stage cloning
98
108
  if ! runuser -u agent -- env \
99
109
  HOME=/tmp/task-handoff-git-home \
100
110
  GIT_TERMINAL_PROMPT=0 \
@@ -104,20 +114,24 @@ if ! runuser -u agent -- env \
104
114
  fi
105
115
 
106
116
  if [ -n "${TASK_HANDOFF_WORKSPACE_GIT_COMMIT:-}" ]; then
117
+ stage checking-out
107
118
  if ! runuser -u agent -- git -C "${checkout}" checkout --detach "${TASK_HANDOFF_WORKSPACE_GIT_COMMIT}"; then
108
119
  fail REF_NOT_FOUND 75
109
120
  fi
110
121
  fi
111
122
  if [ "${TASK_HANDOFF_WORKSPACE_GIT_SUBMODULES:-false}" = "true" ]; then
123
+ stage submodules
112
124
  if ! runuser -u agent -- env \
113
125
  HOME=/tmp/task-handoff-git-home \
114
126
  GIT_TERMINAL_PROMPT=0 \
115
127
  GIT_SSH_COMMAND="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh" \
116
- git "${git_config[@]}" -C "${checkout}" submodule update --init --recursive; then
128
+ git "${git_config[@]}" -C "${checkout}" submodule update --init --recursive --progress; then
117
129
  fail CLONE_FAILED 74
118
130
  fi
119
131
  fi
120
132
  if [ "${TASK_HANDOFF_WORKSPACE_GIT_LFS:-false}" = "true" ]; then
133
+ stage lfs
134
+ # git-lfs has no --progress flag; the stage marker is the progress contract here.
121
135
  if ! runuser -u agent -- env GIT_TERMINAL_PROMPT=0 GIT_SSH_COMMAND="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh" git "${git_config[@]}" -C "${checkout}" lfs pull; then
122
136
  fail LFS_FAILED 76
123
137
  fi
@@ -125,6 +139,8 @@ fi
125
139
  if [ -n "${TASK_HANDOFF_WORKSPACE_SUBDIRECTORY:-}" ] && [ ! -d "${checkout}/${TASK_HANDOFF_WORKSPACE_SUBDIRECTORY}" ]; then
126
140
  fail SUBDIRECTORY_NOT_FOUND 75
127
141
  fi
142
+ stage finalizing
143
+ printf 'TASK_HANDOFF_GIT_PROVISIONING_COMMIT=%s\n' "$(runuser -u agent -- git -C "${checkout}" rev-parse HEAD 2>/dev/null || true)"
128
144
  shopt -s dotglob nullglob
129
145
  mv -- "${checkout}"/* "${workspace}/"
130
146
  rm -rf -- "${staging}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@task-handoff/node-agent",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "Prebuilt TaskHandoff node agent runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "packageName": "@task-handoff/controlled-instance",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
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": "95453d4e40fea01610513922e12386efe03ba53e9715c8f261c8f8c2bacf350d"
9
+ "sha256": "985a0ff231aef1c9c2520864acc3d228f8a73b8c3980658cd3e865a6d13be67c"
10
10
  }
@@ -0,0 +1 @@
1
+ ba57f99e9018c51e716f28fc9805fc4bcdcdd78c78cba40e4d7fa21d2d72e7f0 controlled-instance-runtime-0.0.38-linux-universal.tar.gz
@@ -1 +0,0 @@
1
- 7ee2902522f6159114e52c58d8c267e89a454c7383f2c17fd274bc3b266c7bcd controlled-instance-runtime-0.0.37-linux-universal.tar.gz