Skip to content

Commit 3a53ebd

Browse files
authored
Merge pull request #671 from bhearsum/docs
add basic documentation on scriptworker flow of control
2 parents e363361 + 2866ac0 commit 3a53ebd

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

docs/flow_of_control.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Flow of Control
2+
3+
The way a scriptworker runs can be a bit confusing. It involves `scriptworker` itself and its configuration file, a `script` with its own configuration file, multiple processes, and a surprising amount of indirection. The diagram below attempts to show the flow of control. A few things are of special note:
4+
5+
* The initial entrypoint is the `scriptworker` CLI tool.
6+
* When a Task has been verified, the `script` CLI entry point is run in a subprocess, but that will simply provide `scriptworker.client.sync_main` with a few pieces of data (most notably the `async_main` that actually acts on a Task payload) to continue execution from there. This means that there are two processes that have independently imported `scriptworker` code.
7+
* Task success or failure is communicated back to the `scriptworker` CLI tool through the return code of the subprocess.
8+
9+
![scriptworker flow of control](flow_of_control.svg)

docs/flow_of_control.mm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sequenceDiagram
2+
participant init
3+
box yellow scriptworker codebase
4+
participant s as scriptworker
5+
participant sc as scriptworker.client
6+
end
7+
box green script codebase
8+
participant ss as signingscript
9+
end
10+
init->>s: scriptworker.main
11+
rect rgba(243,166,94,255)
12+
note left of s: scriptworker process
13+
s->>s: read config
14+
s->>s: async_main() (polls for tasks)
15+
s->>s: execute task
16+
s->>s: verify CoT
17+
end
18+
s->>ss: signingscript.main (in subprocess)
19+
rect rgba(169, 226, 235, 255)
20+
note left of ss: signingscript process
21+
ss->>sc: sync_main(signingscript.async_main, config, ...)
22+
sc->>sc: validate config
23+
sc->>sc: setup Context
24+
sc->>ss: async_main(Context)
25+
ss-->>sc: task status
26+
end
27+
sc-->>s: task status
28+
rect rgba(243,166,94,255)
29+
note left of s: scriptworker process
30+
s->>s: create and sign chain-of-trust.json
31+
s->>s: upload artifacts, resolve task
32+
end

0 commit comments

Comments
 (0)