-
Notifications
You must be signed in to change notification settings - Fork 3
Support updating existing tasks #37
Comments
A few more notes:
|
Thinking on this some more, I think the semantics on this could be (for starters) as straight-forward as this:
This should cover all use-cases, except for task renaming, which will have to be its own mutation request, for now, and can be tackled later. |
Actually, one problem I just realised with the above approach is that this would mean any CI-based deployment pipeline would recreate the steps/variables for all tasks on every deploy. Technically, that's not a problem, but it does feel a bit draconian. 🤔 💭 Of course, we could consider that out of scope, and provide some helpful pointers on how to only trigger an update for tasks that have actually changed (using your VCS' history). |
This was solved in 9bc4164. Here's the description from the commit: This change introduces the possibility to update tasks. The implementation is similar to global variables introduced in A new If set to If set to
There is no support in the client(s) yet for creating or updating tasks, |
Right now the API only supports creating tasks. In a continuous deployment setup of Automaat, you'd want to be able to (for example) have your tasks defined as YAML in Git, and then deployed to your Automaat instance using your CI pipeline once a task change is pushed to your base branch.
I think it makes sense to use the
OnConflict
object that already exists for creating/updating global variables:automaat/src/server/schema.graphql
Lines 156 to 159 in fd2db24
For tasks, there are some considerations, that will probably require an extra OnConflict directive.
Here are the thoughts I currently have:
ABORT
,UPDATE
) apply to tasks.ARCHIVE
directive, that works specifically for tasks (for now).archived
flag set.Another solution to the above point would be to simply remove the relationship between jobs and tasks. However, that would mean we can no longer show a history of jobs for any given task. The reference is already weak, so tasks are allowed to be removed without removing the jobs they created, this just means you get a
null
value back for the reference from a job back to a deleted task.One more point to cover when we allow updating tasks is that it can no longer be assumed that the configuration of a job matches that of a task (meaning, a job could have been triggered when a task had different variables or steps configured). This is fine, but I think it makes sense to at least make sure there are
created_at
/updated_at
fields available, so that we can easily detect if a task was changed after a job was created, which could be used in the future to signal that the representation of a job might not match that of an existing task.All of this could also be avoided by making tasks immutable, and simply creating new ones and archiving old ones for every change you make. But I think that's a bit too extreme of a solution in this case (something like event sourcing would help here, but that's way out of scope).
* because we are re-using the
createTask
mutation, we can't ask for a task ID because none might exist yet, so we also can't rename the task. We might also supply anupdateTaskName
mutation that takes and ID, so that you can change the name as well, but I'll leave that out of the scope for now. You can always rename a task using the database itself, until we find a nice way to use this API.The text was updated successfully, but these errors were encountered: