start-command 0.30.0 → 0.30.1
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/lib/args-parser.js +1 -1
- package/src/lib/execution-control.js +3 -3
- package/src/lib/usage.js +1 -1
- package/test/execution-control.js +40 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/lib/args-parser.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* --list List all tracked command executions
|
|
31
31
|
* --upload-log <uuid-or-session> Upload the stored log for a tracked execution
|
|
32
32
|
* --output-format <format> Output format for status/list (links-notation, json, text)
|
|
33
|
-
* --stop <uuid-or-session-name>
|
|
33
|
+
* --stop <uuid-or-session-name> Ask a detached execution to stop gracefully
|
|
34
34
|
* --terminate <uuid-or-session-name> Terminate a detached execution immediately
|
|
35
35
|
* --cleanup Clean up stale "executing" records (processes that crashed or were killed)
|
|
36
36
|
* --cleanup-dry-run Show stale records that would be cleaned up (without actually cleaning)
|
|
@@ -197,9 +197,9 @@ function getControlCommand(record, action) {
|
|
|
197
197
|
case 'docker':
|
|
198
198
|
return {
|
|
199
199
|
command: 'docker',
|
|
200
|
-
args: ['
|
|
201
|
-
method: '
|
|
202
|
-
message: `
|
|
200
|
+
args: ['stop', sessionName],
|
|
201
|
+
method: 'DOCKER_STOP',
|
|
202
|
+
message: `Requested graceful stop for detached docker container: ${sessionName}`,
|
|
203
203
|
};
|
|
204
204
|
default:
|
|
205
205
|
return {
|
package/src/lib/usage.js
CHANGED
|
@@ -27,7 +27,7 @@ Options:
|
|
|
27
27
|
--status <id> Show status of execution by UUID or session name (--output-format: links-notation|json|text)
|
|
28
28
|
--list List all tracked executions (--output-format: links-notation|json|text)
|
|
29
29
|
--upload-log <id> Upload the stored log for an execution UUID or session name
|
|
30
|
-
--stop <id>
|
|
30
|
+
--stop <id> Ask a detached isolated execution to stop gracefully
|
|
31
31
|
--terminate <id> Terminate a detached isolated execution immediately
|
|
32
32
|
--cleanup Clean up stale "executing" records (crashed/killed processes)
|
|
33
33
|
--cleanup-dry-run Show stale records that would be cleaned up (without cleaning)
|
|
@@ -136,6 +136,46 @@ describe('execution control', () => {
|
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
+
it('should stop a detached docker container with docker stop', () => {
|
|
140
|
+
const store = createStore();
|
|
141
|
+
store.save(
|
|
142
|
+
createDetachedRecord({
|
|
143
|
+
uuid: 'docker-control-uuid',
|
|
144
|
+
options: {
|
|
145
|
+
isolated: 'docker',
|
|
146
|
+
isolationMode: 'detached',
|
|
147
|
+
sessionName: 'docker-session',
|
|
148
|
+
containerId: 'abc123',
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
const runner = createRunner({
|
|
153
|
+
'docker inspect -f {{.Id}} {{.State.Pid}} docker-session': {
|
|
154
|
+
success: true,
|
|
155
|
+
stdout: 'abcdef 0\n',
|
|
156
|
+
stderr: '',
|
|
157
|
+
status: 0,
|
|
158
|
+
error: null,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const result = controlExecution(
|
|
163
|
+
store,
|
|
164
|
+
'docker-control-uuid',
|
|
165
|
+
ControlAction.STOP,
|
|
166
|
+
runner
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
assert.strictEqual(result.success, true);
|
|
170
|
+
assert.match(result.output, /action stop/);
|
|
171
|
+
assert.match(result.output, /method DOCKER_STOP/);
|
|
172
|
+
assert.match(result.output, /containerId abcdef/);
|
|
173
|
+
assert.deepStrictEqual(runner.calls[0], {
|
|
174
|
+
command: 'docker',
|
|
175
|
+
args: ['stop', 'docker-session'],
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
139
179
|
it('should send docker terminate through docker kill', () => {
|
|
140
180
|
const store = createStore();
|
|
141
181
|
store.save(
|