agent: implement post tasks #103
Conversation
jclulow
left a comment
There was a problem hiding this comment.
I like the direction! I've made some notes.
| if (LAST_SECTION === null) { | ||
| LAST_SECTION = evr.section; | ||
| /* | ||
| * Due to JavaScript being JavaScript, apparently this is the way to compare | ||
| * two objects :( | ||
| */ | ||
| } else if (JSON.stringify(evr.section) !== JSON.stringify(LAST_SECTION)) { |
There was a problem hiding this comment.
I think the indentation here is not quite right here? Lines should come in with hard tabs (which are 8 columns per tab stop) and then 4 additional spaces if it's a continuation of a previous line.
There was a problem hiding this comment.
Fixed that, and changed the editorconfig to mention using tabs for JS files.
| } | ||
|
|
||
| tr.s_post { | ||
| background-color: #ffd7ef; |
There was a problem hiding this comment.
Pretty! Might be good to provide s_post_stdout and s_post_stderr as well, using different shades, to make them more visually distinct from primary job tasks?
There was a problem hiding this comment.
Added some very light shades of pink for the background of post tasks stdout and stderr.
| "cannot register more than {QUOTA_POST_TASKS_PER_TYPE} post tasks" | ||
| )); | ||
| } | ||
| if queue.iter().any(|p| p.name == task.name) { |
There was a problem hiding this comment.
I feel like we ought, also, to restrict the allowed characters and also the length for post (and background task) names; e.g., no embedded spaces or periods, only visible alphanumeric/hyphen/underscore things, up to 32 characters, etc.
We would then also want to put similar restrictions on stream names in general, I think, up in the server API, where they could be enforced even if someone messes with the agent. I don't know that we sanitise or cap the stream name length today.
There was a problem hiding this comment.
Added validation for post tasks and background jobs! Also opened #104 to implement validation in the server.
83cd528 to
7fbcbb2
Compare
a03e262 to
e470570
Compare
9a07f85 to
9afccf4
Compare
e470570 to
2683833
Compare
2683833 to
f2bcec5
Compare
Note: This PR is stacked on top of #102.
This PR implements "post tasks", commands that can be executed after all tasks are completed, depending on the outcome of those tasks. Post tasks can be defined at runtime with the new
bmat postfamily of commands:Whether to execute success or failure post tasks is decided when the last task is finished: if we are executing success post tasks, a failure in one of them will mark the build as failed, but it will not start executing failure post tasks.