There's no new endpoints, but there's some modifications to the existing ones.
=== Extracting the current state of the deployment ===
In order to be able to create a deployment plan, we will have to be able to extract (from builds/jobs-api) the current state of the deployment to compare against the desired one.
This means that we might want to fully model a 'tool status', so this will include that exercise.
=== [[ https://en.wikipedia.org/wiki/Directed_acyclic_graph | DAG pipeline resolution ]] ===
When we get a new deployment request, the `/tool/<toolname>/deploy` endpoint has to:
* Diff the intended state with the current state
* Get the sorted list of tasks to execute
There is a small POC of that resolution algorithm here https://gitlab.wikimedia.org/sstefanova/toolforge-toolconfig-poc (by Slavina Stefanova)
=== Pipeline execution ===
See the decision request on how to implement the asynchronous pipeline running: {T362224}
=== Showing the expected deployment plan ===
We could implement some option to just show the deployment plan but not acting on it, that would help debugging.
That could be done with something like `toolforge components deploy --only-plan`.
If that helps, then we will have to add that option to the deploy endpoint.
=== Example config to be implemented ===
The key new data bits are:
* `type` -> specifies the component type, either `continuous` or `scheduled`
* `run[*]` -> add all the options for both scheduled jobs and continuous jobs respectively
* `wait-for` -> to define the order of deployment
This might have changed (depends on how the previous tasks end), but you should be able to do something like:
```
$ cat mytool.yaml
config-version: 0.1
components:
toolhunt-cleanup:
description: cleanup job
type: scheduled
build:
repository: https://github.com/wikimedia/toolhunt-cleanup
wait-for:
- toolhunt-api
run:
command: cleanup
schedule: "00 * * * *"
toolhunt-api:
description: a python-flask api
type: continuous
build:
repository: https://github.com/wikimedia/toolhunt
toolhunt-flower:
description: dashboard for monitoring and managing celery
type: continuous
build:
reuse-from: toolhunt-api
run:
command: flower
wait-for:
- toolhunt-api
$ toolforge component deploy mytool.yaml
Starting deploy for toolhunt v1.0.0...
Building images:
[✅] toolhunt-cleanup
[✅] toolhunt-api
Deploying components:
[✅] toolhunt-api
[✅] toolhunt-cleanup (waiting for toolhunt-api)
[✅] toolhunt-flower (waiting for toolhunt-api)
All components deployed
``