Skip to content

Make it possible to update workflow templates

Workflow templates can only be created through the API and debusine-client. The debusine-client command looks like this:

$ debusine create-workflow-template --help
usage: debusine create-workflow-template [-h] [--workspace WORKSPACE] [--data DATA]
                                         [--priority PRIORITY]
                                         template_name task_name

positional arguments:
  template_name         Name of the new workflow template
  task_name             Name of the workflow task that the template will use

options:
  -h, --help            show this help message and exit
  --workspace WORKSPACE
                        Workspace name
  --data DATA           File path (or - for stdin) to read the data or the workflow template. YAML
                        format. Defaults to stdin.
  --priority PRIORITY   Base priority for work requests created from this template

We need to add a feature to make it possible to update a workflow template.

We want to extend the API and debusine client to support this. On the debusine-client side, the command should look like this:

debusine update-workflow-template [-h] [--workspace WORKSPACE] [--interactive | --data DATA] 
                                  [--priority PRIORITY] [--rename NEW_NAME] template_name

It would behave that way:

  • If neither --interactive nor --data are passed, then the underlying template data is not modified, the expectation is that --priority or --rename are used to perform some changes.
  • If --interactive is passed, the current template data is downloaded, stored in a file, opened in a text editor, and when the user leaves the text editor, the diff is showed as a confirmation, and if the user approves, then it's updated on the server.
  • If --data is passed, then the template data is directly overwritten without any confirmation. We support --data - to provide the data in stdin.

Comments

  • We do not allow to change the underlying "task_name" once the workflow template has been created.

Open questions

  • The proposed design is based on the current structure of the command line interface. For debusine-admin, we ended up restructuring the interface to have things like "workspace create" or "workspace manage" instead of many "create-for" or "manage-foo". Shall we start doing the same for debusine client?
    • If yes, I could see the case for workflow-template create, workflow-template update-data and workflow-template manage.
  • Do we want an audit log of the modifications?
  • Shall we have update-workflow-template to update the template data and manage-workflow-template to perform the changes for other properties?
  • We noticed recently that workflow templates should have default overridable values, implementing this might have a big impact on the design of the commands here. Shall we do that first?
Original ticket by lool Currently updating workflow templates requires database updates. One example scenario for this is if one deploys debusine for one set of architectures with a workflow template listing an initial set of architectures, and then a new architecture gets added/removed, then a number of workflow templates such as to update environments would need to be updated.

It would be nice to provide some simpler/friendlier way of updating workflow templates.

Edited by Raphaël Hertzog
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information