Commit Graph

525 Commits

Author SHA1 Message Date
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
Simone Gotti
782750e51e project: save remote repository id 2019-04-11 17:11:17 +02:00
Simone Gotti
4e07550f30 toolbox: create tmp dir if missing
Create the tmp dir if the image doesn't have one.
2019-04-11 16:46:24 +02:00
Simone Gotti
634a8a543c runservice: implement docker registry auth
By now just support default username/password login

In future also support additional container registries with their own credential
helpers
2019-04-10 17:13:51 +02:00
Simone Gotti
298ffc3529 config: generalize and simplify value string/from_variable parsing 2019-04-10 17:12:39 +02:00
Simone Gotti
751361daea runservice: refactor scheduling logic
* split functions in sub parts to ease future testing
* save run fewer times
* rework events logic to considere both run phase and result changes (emit an
event on every phase or result change)
2019-04-10 14:48:47 +02:00
Simone Gotti
da27348a1d runservice: implement run setup errors
Add the ability to define a run with a setuperror phase.

When the run setup has errors client could submit a run with a list of setup
errors. In such case the run will be created in the setuperror phase.

Setup errors are currently generated by the webhook receiver and the run service
when it checks the run config for possible issues.
2019-04-09 16:51:37 +02:00
Simone Gotti
671b89d391 runservice: merge RunConfig and RunData
* Use just RunConfig
* Use StaticEnvironment vs Environment in RunConfig to distinguish between env
that won't change at run recreation from env that could change at every
recreation
* The RunCreate api will just receive the runtasks instead of a runconfig (more
right)
2019-04-09 18:11:00 +02:00
Simone Gotti
3642be6f21 */api: Use helpers for error handling
* client: always parse the json error message field and return its contents
* Use ErrBadRequest and ErrNotFound in every handler and command
* Gateway: by default pass underlying service error (configstore, runservice) to
client keeping the status code and message. In future, if some errors must be
masked, we should change the specific parts that need special handling.
2019-04-09 14:53:00 +02:00
Simone Gotti
643dfe4072 runservice api: improve response handling
* Command: use ErrBadRequest
* Always return a json message also on error. For internal errors return a
generic "internal server error" message to not leak the real internal error to
clients
* Return 201 Created on resource creation
* Return 204 No Content on resource deletion and other action with no json
output
2019-04-08 18:04:42 +02:00
Simone Gotti
7d787c5f77 *: implement task approval 2019-04-08 17:29:57 +02:00
Simone Gotti
81537f882f gateway: fix runs url to plural 2019-04-08 16:11:19 +02:00
Simone Gotti
14bc618a91 types: add MatchWhen tests 2019-04-08 16:05:53 +02:00
Simone Gotti
4fb250a668 configstore api: improve response handling
* Always return a json message also on error. For internal errors return a
generic "internal server error" message to not leak the real internal error to
clients
* Return 201 Created on resource creation
* Return 204 No Content on resource deletion and other action with no json
output
2019-04-08 12:29:25 +02:00
Simone Gotti
04f3905ea1 client: fix content type header case 2019-04-08 12:28:15 +02:00
Simone Gotti
03b5a53510 gateway/command: use ErrBadRequest when needed 2019-04-08 12:08:31 +02:00
Simone Gotti
56d903d4db gateway api: improve response handling
* Always return a json message also on error. For internal errors return a
generic "internal server error" message to not leak the real internal error to
clients
* Return 201 Created on resource creation
* Return 204 No Content on resource deletion and other action with no json
output
2019-04-08 11:35:45 +02:00
Simone Gotti
763d77d899 gateway: rename projectid to projectref 2019-04-08 09:04:55 +02:00
Simone Gotti
f3781c9087 *: fix rest methods
* use POST instead of PUT for resource creation
* use PUT instead of POST for resource special actions
2019-04-08 08:54:45 +02:00
Simone Gotti
595590e611 api: use httpError helper everywhere 2019-04-05 16:33:00 +02:00
Simone Gotti
fe5bc2fa31 gw repos: use config provided gitServerURL 2019-04-05 16:23:54 +02:00
Simone Gotti
ac28731d11 gateway: only admin or the same logged user can create an user token 2019-04-05 15:56:06 +02:00
Simone Gotti
200aef20b9 configstore: create token only if it doesn't exists 2019-04-05 15:06:26 +02:00
Simone Gotti
c4310be7de Implement user token delete 2019-04-05 15:01:57 +02:00
Simone Gotti
3a41e66f5b cmd: implement variable delete 2019-04-05 11:11:27 +02:00
Simone Gotti
2e335effe9 cmd: implement secret delete 2019-04-05 11:00:45 +02:00
Simone Gotti
42becb0505 update secret create 2019-04-05 10:32:32 +02:00
Simone Gotti
25eb200625 gw api: fix matching secret logic 2019-04-05 10:26:35 +02:00
Simone Gotti
7be0ae205f update .agola/config.yml 2019-04-03 18:05:34 +02:00
Simone Gotti
58a77ad221 gateway: handle skipped webhook 2019-04-03 17:05:50 +02:00
Simone Gotti
84879bf591 gateway: limit requests to a predefined max size 2019-04-03 16:59:17 +02:00
Simone Gotti
0a32b78359 gitsources: implement gitlab hooks
* Generalize to use repopath instead of (owner, reponame)
2019-04-03 15:01:21 +02:00
Simone Gotti
4cf72748b4 gitsources: update api
* Generalize to use repopath instead of (owner, reponame)
2019-04-03 15:01:21 +02:00
Simone Gotti
a2cd92c70b webhook: use provided userID 2019-04-03 15:11:50 +02:00
Simone Gotti
2548598bb8 localrun: use userid and pass it to webhook 2019-04-03 14:59:24 +02:00
Simone Gotti
2d68be8a30 gw api: fix project and remotesource to return the right response 2019-04-03 15:08:33 +02:00
Simone Gotti
bb21520133 gw api client: add GetCurrentUser 2019-04-03 15:06:02 +02:00
Simone Gotti
9d559d49d7 webhook: correctly handle git host and port
* split host and port from the git url
* also set the port in the generated ssh config
2019-04-03 12:27:09 +02:00
Simone Gotti
3d39553189 project create: user project path
Use project path for project creation and get the project clone url directly
from the remote source
2019-04-03 11:07:54 +02:00
Simone Gotti
6736f5aebc gw api: require at least one group on runs query api 2019-04-03 08:52:29 +02:00
Simone Gotti
e2bc2043d0 update Dockerfile
add default config for local testing
2019-04-03 08:52:00 +02:00