Commit Graph

215 Commits

Author SHA1 Message Date
Simone Gotti 2c3e6bf9e4 wal: update and rename to datamanager
* Rename to datamanager since it handles a complete "database" backed by an
objectstorage and etcd

* Don't write every single entry as a single file but group them in a single
file. In future improve this to split the data in multiple files of a max size.
2019-04-26 16:00:03 +02:00
Simone Gotti 41e333d7ec *: rename "lts" to "ost"
`lts` was choosen to reflect a "long term storage" but currently it's just an
object storage implementation. So use this term and "ost" as its abbreviation
(to not clash with "os").
2019-04-27 15:16:48 +02:00
Simone Gotti 33c328b3f5 runservice: move all scheduler etcd data to own dir 2019-04-27 08:59:47 +02:00
Simone Gotti e1368d18d6 runservice: add etcd pinger loop 2019-04-27 08:50:25 +02:00
Simone Gotti 9c7c589bba runservice executor: use k8s client informers/listers
Use k8s client informers/listers instead of polling the api every time
2019-04-26 10:15:23 +02:00
Simone Gotti 8989bd0e8e runservice: pass arch to driver
k8s driver: use the provided arch and set the related nodeselector label
(`kubernetes.io/arch`) when not empty.
2019-04-25 13:42:34 +02:00
Simone Gotti 6f88bd3d53 runservice: handle multiple executor archs
An executor can handle multiple archs (an executor that talks with a k8s cluster
with multi arch nodes). Don't use a label for archs but a custom executor
field.
2019-04-25 13:30:46 +02:00
Simone Gotti e0d37b08f2 runservice: add k8s driver 2019-04-22 17:54:24 +02:00
Simone Gotti 90d129750d util: add pointer utils 2019-04-24 16:31:14 +02:00
Simone Gotti 07bc4a21ff runservice scheduler: automatically remove dynamic executors 2019-04-24 13:25:41 +02:00
Simone Gotti 7c9be9b57d runservice executor: remove unused GetPodByID method 2019-04-24 15:53:03 +02:00
Simone Gotti a0d69f4bc3 runservice executor: update for executor groups
* Add the concept of executor groups and siblings executors
* Add the concept of dynamic executor: an executor in an executor group that
doesn't need to be manually deleted from the scheduler since the other sibling
executors will take care of cleaning up its pods.
* Remove external labels visibility from pod.
* Add functions to return the sibling executors and the executor group
* Delete pods of disappeared sibling executors
2019-04-24 12:37:55 +02:00
Simone Gotti 4da4f48f98 runservice executor: rename pod labels
* Use a command namespaced prefix
* Add executor id label for future usage
2019-04-22 18:19:43 +02:00
Simone Gotti abf908bcad runservice executor: rename makeEnv to makeEnvSlice 2019-04-22 18:19:13 +02:00
Simone Gotti 7e9abbf529 runservice executor: add driver Setup method
Remote custom `copytoolbox` hack and use a generic `Setup` function in the
driver interface
2019-04-22 18:17:55 +02:00
Simone Gotti 7ebc436854 runservice executor: generate pod id outside driver 2019-04-22 17:53:34 +02:00
Simone Gotti 17f3dc89f2 runservice executor: remove unused CopyTo method from driver 2019-04-22 18:27:48 +02:00
Simone Gotti f85ffb594f runservice toolbox: add exec command 2019-04-22 17:49:18 +02:00
Simone Gotti dfeba334f6 runservice: update docker registry auth 2019-04-22 14:38:25 +02:00
Simone Gotti d91bb36ccb cmd serve: update parse config error 2019-04-21 15:27:35 +02:00
Simone Gotti 9c74b4ddc1 runservice scheduler: choose scheduler only if it has capacity 2019-04-17 20:59:28 +02:00
Simone Gotti 1ac139434e runservice scheduler: cancel unscheduled root tasks when run has result
When run has a result set, root tasks not yet scheduled must be cancelled.
2019-04-17 18:00:34 +02:00
Simone Gotti 9f89a923c0 runservice scheduler: take a copy of run in advanceRunTasks
take and change a copy of the current run so we'll change newRun and use curRun
status for logic decision. In this way result are reproducible or they will be
affected by the random run.Tasks map iteration order.
2019-04-17 18:06:31 +02:00
Simone Gotti 4dd89646af runservice executor: report ActiveTasksLimit
Add a config option to set the active tasks limit and report it.
2019-04-17 15:51:20 +02:00
Simone Gotti 455623e58a runservice executor: report running tasks 2019-04-17 15:47:58 +02:00
Simone Gotti adf9c73518 runservice scheduler: choose executor with right arch
Choose an executor matching the required arch or any if no arch is required
2019-04-17 15:26:09 +02:00
Simone Gotti f3e583bb40 config: check Runtime.Arch 2019-04-17 15:24:37 +02:00
Simone Gotti 22f0865aa3 runconfig: add and populate Runtime.Arch 2019-04-17 15:23:50 +02:00
Simone Gotti a511fbf10c runservice: executor: provide architecture information 2019-04-17 15:22:26 +02:00
Simone Gotti d3e95ba665 runservice config: set executor labels 2019-04-17 15:25:11 +02:00
Simone Gotti d3f658c5ad runservice: add run cache cleaner
Removes old cache entries (defaults to 7 days)
2019-04-17 13:58:41 +02:00
Simone Gotti 4c19ea3e91 remove .agola/config.yml
since we use the jsonnet format
2019-04-16 17:51:39 +02:00
Simone Gotti fcba3ccfad tests: add config.jsonnet
Use a jsonnet config that make creating matrix build and tests a breeze
2019-04-16 15:37:23 +02:00
Simone Gotti ebe34ba1fa runservice: set default config task working_dir
Set default task working_dir to ~/project
2019-04-16 15:20:45 +02:00
Simone Gotti 4c30a5af1c runservice: handle jsonnet and json config files
Handle config files with name `config.jsonnet`, `config.json` and
`config.yml` and take the first from the repository in this order

For a jsonnet file execute it and use the generated output as the config
2019-04-16 15:00:37 +02:00
Simone Gotti 03451535c8 runservice: rework config format
The current config format was thought for future extensions for reusing runtimes
and job definitions adding some parameters.

After a lot of thoughts this looks like a complex approach: the final result
will be a sort of templating without a lot of powers.

Other approach like external templating should be an alternative but I really
don't think templating yaml is the way to go.

A much better approach will to just use jsonnet when we need to create matrix
runs and a lot of other use cases.

So just make the config a simple yaml/json. User can generate their config using
any preferred tool and in future we'll leverage jsonnet automated parsing and
provide a lot of jsonnet based examples for most use cases.

Main changes:

* Runs are now an array and not a map. The run name is in the Name field
* Tasks are now an array and not a map. The task name is in the Name field
* Use https://github.com/ghodss/yaml so we'll use json struct tags and unmarshall functions
2019-04-16 11:01:02 +02:00
Simone Gotti 6066221136 runservice: rename config pipeline(s) to run(s)
No need for different names. We are always talking about a run. In the config
it's the run definition, in the service is the run execution.
2019-04-15 23:42:10 +02:00
Simone Gotti 06374e14fd runservice: resolve ~ in working_dir 2019-04-15 11:12:07 +02:00
Simone Gotti 351f7518de toolbox: add toolbox mkdir 2019-04-15 14:33:55 +02:00
Simone Gotti ac7447a5c9 toolbox: add expanddir command 2019-04-15 14:33:26 +02:00
Simone Gotti 8bde2f2bc0 runservice: implement caching
Add `save_cache` and `restore_cache steps`
2019-04-13 14:58:56 +02:00
Simone Gotti 57161477ca objectstorage: return object last modified time 2019-04-15 09:37:34 +02:00
Simone Gotti 9c2ac68a75 toolbox: add template command 2019-04-14 15:10:54 +02:00
Simone Gotti 4c12b03544 toolbox: expand archive/unarchive starting tilde
Expand archive sourceDir(s) and unarchive DestDir
2019-04-13 14:56:35 +02:00
Simone Gotti 3928851c10 runservice: rename Run.RunTasks to Run.Tasks 2019-04-12 17:45:38 +02:00
Simone Gotti 68e95ad3be runservice: implement task dependencies conditions
Handle the task dependencies conditions:
* on_success (default if no conditions are specified)
* on_failure
* on_skipped

Not the runservice won't stop run but continue executing tasks that depends on a
parent also if this is failed
2019-04-12 16:46:04 +02:00
Simone Gotti 5165984030 runservice: convert RunConfigTask.Depends to a map 2019-04-12 17:04:07 +02:00
Simone Gotti 991fcc59de runservice: stop all running executor tasks when run is marked to stop 2019-04-11 23:44:55 +02:00
Simone Gotti c300a37d09 runservice: add some initial scheduler tests 2019-04-11 17:23:59 +02:00
Simone Gotti ca1d837ecd webhook: use hook provided ssh url for cloning
Additionally don't save a CloneURL field inside the project type.

If in future some git source doesn't provide a clone url we could just calculate
it from project.RepoPath or call the remote api to retrieve it.
2019-04-11 16:49:07 +02:00