Simone Gotti
21e706a150
configstore: add get org members api/action
2019-05-14 12:57:53 +02:00
Simone Gotti
8f959c4500
cmd: add org member add/remove commands
2019-05-14 11:25:12 +02:00
Simone Gotti
aeda922a7d
*: rename deleteOrgMember to removeOrgMember
2019-05-14 11:20:09 +02:00
Simone Gotti
c5cdf01332
*: add organizations visibility
2019-05-14 10:56:17 +02:00
Simone Gotti
c41de71694
gateway api: return linked account id
2019-05-13 23:12:48 +02:00
Simone Gotti
a4744ab7f4
gateway: return right error when remotesource login fails
...
If the remote source username/password based login fails return the right error
code: 401 (unauthorized) on wrong username/password or a 500 on other errors.
2019-05-13 14:23:41 +02:00
Simone Gotti
a7ecfee795
gitea: use custom http request for get tokens
...
Since the get tokens gitea api is used to do auth by username password we need
to know the api status code to detect if it's an unauthorized error (wrong
username/password) or another error.
Since the gitea client doesn't return the http response to inspect the status
code we'll use our own api call.
2019-05-13 14:21:41 +02:00
Simone Gotti
8331c43a18
util errors: add ErrUnauthorized
2019-05-13 14:20:31 +02:00
Simone Gotti
4a8d86ae76
gateway: implement projectgroup delete
2019-05-13 00:24:16 +02:00
Simone Gotti
d551dcb820
configstore: implement projectgroup delete
2019-05-13 00:23:57 +02:00
Simone Gotti
5c15eb4db7
configstore: move getvariables to action
2019-05-13 00:23:08 +02:00
Simone Gotti
295ed6e39a
configstore: move get secret(s) to action
2019-05-13 00:22:23 +02:00
Simone Gotti
0f9445aabe
configstore: move get projecgroup projects/subgroups to action
2019-05-13 00:21:10 +02:00
Simone Gotti
5dfe7f8ce9
gateway api: return projectgroup visibility
2019-05-12 23:24:48 +02:00
Simone Gotti
d2d1a5fb65
gateway api: return project visibility
2019-05-12 23:23:30 +02:00
Simone Gotti
83f6ebe95f
gateway: implement updateProject
...
Update project currently handles updating project name and visibility. In future
we'll add additional update logic.
2019-05-12 23:22:18 +02:00
Simone Gotti
4c35c88b32
fix auth
2019-05-12 23:19:56 +02:00
Simone Gotti
8e70c6b1b9
gateway: use authOptionalHandle with logHandler
...
or it'll fail when fetching logs on user runs since the logged in userid is not
set in the context
2019-05-12 00:28:50 +02:00
Simone Gotti
55b4a94281
gateway api: remove unused exposedURL variable
2019-05-12 00:28:11 +02:00
Simone Gotti
caa9d74b72
runservice: implement additional service containers
...
This was already defined in the config but not implemented in the executor and
drivers.
All the containers defined in the runtime after the first one will be "service"
containers. They will share the same network namespace with the other containers
in the "pod" so they can communicate between themself on loopback
2019-05-10 17:31:23 +02:00
Simone Gotti
7adca3ea30
runservice drivers: define ExecConfig AttachStdin
2019-05-10 16:50:31 +02:00
Simone Gotti
ba5399b97e
config/runconfig: add global docker registries auth
2019-05-10 11:45:00 +02:00
Simone Gotti
59e4a1f0ba
runservice: update runconfig group comment
2019-05-10 11:16:57 +02:00
Simone Gotti
0c94386149
gateway: add badges endpoint
...
Currently we generate badges only for projects branches. In future this could be
extended to also generate badges for tags and PRs
2019-05-10 11:08:24 +02:00
Simone Gotti
c523bcba4e
gateway: add delete remote source handler
2019-05-10 00:03:03 +02:00
Simone Gotti
c9fb7258ec
configstore: fix delete remote source action
2019-05-10 00:02:37 +02:00
Simone Gotti
da224c7580
executor: make docker driver logger sugared
2019-05-09 23:44:41 +02:00
Simone Gotti
b0fe7e4115
*: implement delete organization member
2019-05-09 17:05:13 +02:00
Simone Gotti
d0309db97f
types: add RemoteUserAvatarURL to User
2019-05-09 16:49:02 +02:00
Simone Gotti
b37eddbe8b
gateway: remove omitempty json struct tag from UserResponse
2019-05-09 16:48:28 +02:00
Simone Gotti
620bae68df
*: implement add/update org member
2019-05-09 16:47:22 +02:00
Simone Gotti
8069063e0d
gateway: add project update repo linked account api
...
Change the project repo linked account to the one of the current user
2019-05-09 15:36:47 +02:00
Simone Gotti
a43be4a6be
gateway: update CreateProject api
...
remove currentuserid since we can get it directly in the action
2019-05-09 15:34:58 +02:00
Simone Gotti
e1d0318c9b
configstore: add UpdateProject api
2019-05-09 15:33:57 +02:00
Simone Gotti
79c1a60a36
configstore: update CreateProject action
...
* move validation to ValidateProject function
* remove wrong project group check
2019-05-09 15:32:27 +02:00
Simone Gotti
92de7591da
gitsources: implement gitea oauth2 auth
...
As from https://github.com/go-gitea/gitea/pull/5378 gitea is an oauth2 provider.
2019-05-09 14:14:13 +02:00
Simone Gotti
4e785e4851
runservice: build and use multiple toolboxes per architecture
2019-05-09 12:36:30 +02:00
Simone Gotti
ce7924d7fd
runservice: use the path escaped cache key
...
Use the path escaped cache key so we can also handle cache keys with slashes
inside.
2019-05-08 12:15:17 +02:00
Simone Gotti
bec9476d6c
runservice: store related runid with logs and archives
...
Logs and archives can be shared by multiple runs. So removing a run doesn't
imply that we could also remote the logs and archives since they could be
"referenced" by another run.
Store also the runids as specific objects along with the logs and archives so,
we'll remove them only when no runids objects exist.
2019-05-08 12:11:46 +02:00
Simone Gotti
43341f2cba
*: rename GitServer to Gitserver
2019-05-08 15:23:13 +02:00
Simone Gotti
1e34dca95d
runservice: split and simplify scheduler and executor naming
...
Also if they are logically part of the runservice the names runserviceExecutor
and runserviceScheduler are long and quite confusing for an external user
Simplify them separating both the code parts and updating the names:
runserviceScheduler -> runservice
runserviceExecutor -> executor
2019-05-07 23:56:10 +02:00
Simone Gotti
44d5b0f25a
*: rename ConfigStore to Configstore
2019-05-07 23:42:42 +02:00
Simone Gotti
e4e7de4ad2
runservice/gateway: return run on run action
2019-05-07 23:23:58 +02:00
Simone Gotti
83273489e0
jwt: unify token generation functions
2019-05-07 18:30:20 +02:00
Simone Gotti
649c42f75b
gitsources: create secret and webhook secret
...
Use the webhook secret on webhook creation and check it and webhook receive
2019-05-07 18:29:31 +02:00
Simone Gotti
2675aee333
configstore: generate User and Project secret
2019-05-07 17:16:42 +02:00
Simone Gotti
4154be3370
*: set sshhostkey and skip check on remote source
2019-05-07 15:59:08 +02:00
Simone Gotti
afae185e11
*: rework run approval and annotations
...
* runservice: use generic task annotations instead of approval annotations
* runservice: add method to set task annotations
* gateway: when an user call the run task approval action, it will set in the
task annotations the approval users ids. The task won't be approved.
* scheduler: when the number of approvers meets the required minimum number
(currently 1) call the runservice to approve the task
In this way we could easily implement some approval features like requiring a
minimum number of approvers (saved in the task annotations) before marking the
run as approved in the runservice.
2019-05-06 15:19:29 +02:00
Simone Gotti
a590c21127
runservice api: get run from readdb
2019-05-06 15:18:49 +02:00
Simone Gotti
3139ef38d9
runservice readdb: get run from ost db if it's not in run db
2019-05-06 14:55:10 +02:00
Simone Gotti
a04dd62e91
gateway: initial authorization
2019-05-03 23:19:23 +02:00
Simone Gotti
081ac8a44f
gateway: move webhook genGroup to common as GenRunGroup
2019-05-05 23:58:40 +02:00
Simone Gotti
6ef5649b21
gateway: set user admin value in context
2019-05-05 17:30:38 +02:00
Simone Gotti
6dfb789e77
gateway: project(group) create: rename parentID to parentRef
2019-05-05 17:19:23 +02:00
Simone Gotti
05ae46a72d
gateway: move run logic from api to actions
2019-05-06 00:00:45 +02:00
Simone Gotti
6b5bd40417
gateway: move remaining remotesource logic from api to actions
2019-05-05 14:54:16 +02:00
Simone Gotti
42184d0b5b
gateway: move remaining user logic from api to actions
2019-05-05 14:45:19 +02:00
Simone Gotti
96918e9bad
gateway: move remaining org logic from api to actions
2019-05-05 14:36:14 +02:00
Simone Gotti
c889c2c1c2
gateway: move remaining project(group) logic from api to actions
2019-05-05 14:27:22 +02:00
Simone Gotti
64044df94d
gateway: move secret logic from api to actions
2019-05-05 14:11:29 +02:00
Simone Gotti
f73f0ba434
gateway: move variable logic from api to actions
2019-05-04 15:16:49 +02:00
Simone Gotti
cb78ea48bc
runservice: rename command(handler) to action(handler)
...
Since we're going to migrate all actions (also queries that now are implemented
in the api handlers) there
2019-05-03 23:59:21 +02:00
Simone Gotti
3f7e554f04
gateway: rename command(handler) to action(handler)
...
Since we're going to migrate all actions (also queries that now are implemented
in the api handlers) there
2019-05-03 23:48:49 +02:00
Simone Gotti
ca5b5f3a7e
configstore: rename command(handler) to action(handler)
...
Since we're going to migrate all actions (also queries that now are implemented
in the api handlers) there
2019-05-03 23:35:25 +02:00
Simone Gotti
5a50a2681d
util/errors: add ErrForbidden
2019-05-03 23:18:51 +02:00
Simone Gotti
af67198dec
configstore: report project/projectgroup owners
...
Return project and projectgroup owner type (user or org) and their id.
2019-05-03 23:17:07 +02:00
Simone Gotti
81d656b7a3
configstore: implement organization members
2019-05-03 17:40:07 +02:00
Simone Gotti
a269347c9d
types: add Admin field to User
2019-05-03 17:38:12 +02:00
Simone Gotti
041e8867f8
*: add creatorUserID and cretedAt to organization
2019-05-03 14:24:18 +02:00
Simone Gotti
c30707528f
configstore: split commands in multiple files
2019-05-03 12:47:22 +02:00
Simone Gotti
60feff5cef
configstore: add more validations
...
All the validation must be done inside the configstore since it's the source of
truth.
The gateway could also do some validation to avoid bad requests to the
configstore when needed or when the logic resides outside the configstore (like
project setup or user registration)
2019-05-03 12:41:49 +02:00
Simone Gotti
1f09eea949
project: add remote repository config type
...
RemoteRepositoryConfigType defines how a remote repository is configured and
managed. Currently only "remotesource" is supported.
In future other config types (like a fully manual config) could be supported.
2019-05-03 12:21:44 +02:00
Simone Gotti
ea02eed2d9
* api: accept both ids or names in the same endpoint
...
Simplify api to accept both ids or names in the same endpoint
2019-05-03 11:07:53 +02:00
Simone Gotti
6943c10dc9
types: add RemoteSourceID to Project
...
In future we may support specifying a remote source for a project without a
linked account and thus use a user provided token (saved in the project) or
other ways to define a remote repo (like standard git repos over ssh).
2019-05-03 09:55:37 +02:00
Simone Gotti
b9db3137ad
gateway api: return user linked accounts
2019-05-03 09:54:47 +02:00
Simone Gotti
9349728997
configstore: add update user
2019-05-03 09:53:38 +02:00
Simone Gotti
ab7e4b8a4b
gateway: add user remote repos API
2019-05-03 00:11:11 +02:00
Simone Gotti
0471bf0c30
validation: make uuid like names not valid
...
names that are valid uuids are not valid. This is needed to accept both names or
uuid in rest APIs without using a special syntax to distinguish them
2019-05-02 23:40:28 +02:00
Simone Gotti
bad18bf814
*: report objects size for objectstorage.WriteObject
2019-05-02 09:49:55 +02:00
Simone Gotti
34cfdfeb3b
objectstorage: add size option to WriteObject
...
On s3 limit the max object size to 1GiB when the size is not provided (-1) or
the minio client will calculate a big part size since it tries to use the
maximum object size (5TiB) and will allocate a very big buffer in ram. Also
leave as commented out the previous hack that was firstly creating the file
locally to calculate the size and then put it (for future reference).
2019-05-02 09:47:38 +02:00
Simone Gotti
e964aa3537
objectstorage: add persist option to WriteObject
...
This options is a noop on s3 but on the posix implementation it becomes useful
when there isn't the need to have a persistent file, thus avoiding some fsync
calls.
2019-05-01 15:06:47 +02:00
Simone Gotti
68e6bd5bdf
configstore: add project/projectgroup visibility
2019-04-30 17:09:26 +02:00
Simone Gotti
b1c9892378
configstore: report project/projectgroup path
...
and also parent path
2019-04-30 17:09:26 +02:00
Simone Gotti
c7585a6152
configstore: resolve also org and user paths
2019-05-03 13:48:19 +02:00
Simone Gotti
2215aaebfa
configstore: rename GetParentPath to GetPath
...
and rename file from parent.go to resolve.go
2019-04-30 17:06:44 +02:00
Simone Gotti
984efb539e
configstore: use augmented types for vars/secrets dynamic values
2019-04-30 16:28:01 +02:00
Simone Gotti
da2ac0ab38
util: add path functions
...
add IsParentPath and IsSameOrParent path functions and related tests
2019-04-30 16:24:04 +02:00
Simone Gotti
27f84738d6
runservice: simplify workspace restore
2019-04-30 14:00:34 +02:00
Simone Gotti
1820e7c477
types: rename user UserName field to Name
2019-04-30 12:56:43 +02:00
Simone Gotti
1e1152cb1a
gateway: set agolaid query parameter in webhook url
2019-04-30 12:13:51 +02:00
Simone Gotti
fefa2819c9
gateway: use agola ID in gitsource tokenname
2019-04-30 12:13:12 +02:00
Simone Gotti
e970e217e2
config: add global agola id field
2019-04-30 12:08:59 +02:00
Simone Gotti
559a389b59
gitsources: add ListUserRepos method
2019-04-29 17:36:29 +02:00
Simone Gotti
507a9edb87
gitsources: add CreateCommitStatus method
2019-04-29 17:35:07 +02:00
Simone Gotti
2fab8ad85b
configstore: check token name is not empty
2019-04-29 16:59:09 +02:00
Simone Gotti
cbd971619b
gateway: refresh oauth2 token when needed
...
refresh the oauth2 access token when needed and update the related linked
account.
2019-04-29 15:42:10 +02:00
Simone Gotti
9393830207
gitsource: add RefreshOauth2Token method to Oauth2Source
2019-04-29 15:39:59 +02:00
Simone Gotti
95e73e66a0
oauth2: correctly populate token expiry data
...
* Populate the field when needed
* Convert it to a time instead of a duration
2019-04-29 14:57:07 +02:00
Simone Gotti
52bcf096c7
gitea source: add custom http transport
2019-04-29 11:24:03 +02:00
Simone Gotti
a5d6ac85a6
configstore: namespace changegroups
2019-04-29 10:37:23 +02:00
Simone Gotti
159abffa06
configstore: fix changegroup names
...
changegroup names are based on names that will contain slashes and could be very
long. So calculate the sha256 sum of the starting name and use it as the
changegroup name.
2019-04-29 10:24:05 +02:00
Simone Gotti
da6aefa7e2
runservice readdb: also resync changegroups
2019-04-29 10:16:19 +02:00
Simone Gotti
19877e679c
configstore readdb: also resync changegroups
2019-04-29 10:15:44 +02:00
Simone Gotti
2634f7a3a0
datamanager: add function to get changegroups from etcd
2019-04-29 10:13:13 +02:00
Simone Gotti
f5cf3b9fa7
runservice: check changegroup name
2019-04-29 10:12:34 +02:00
Simone Gotti
b85786dc56
datamanager: check changegroup name
2019-04-29 10:12:03 +02:00
Simone Gotti
340cc15268
scheduler: fix changegroup names
...
run changegroup names are based on the run path but it will contain slashes and
could be very long. So calculate the sha256 sum of the path and use it as the
changegroup name.
2019-04-29 10:14:10 +02:00
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
dfeba334f6
runservice: update docker registry auth
2019-04-22 14:38:25 +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
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
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
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
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
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
f0e7ce4a96
cmd: implement project/projectgroup variable create
2019-04-02 11:07:39 +02:00
Simone Gotti
99a6c12f98
project delete: use project ref
2019-04-02 11:06:45 +02:00
Simone Gotti
ed502276ba
update configstore for previous wal changes
2019-04-03 18:11:31 +02:00
Simone Gotti
fc891409ca
update wal and readdb
2019-04-01 12:54:43 +02:00
Simone Gotti
eb8cd9cc52
gateway: add user registration
...
Adds two handler:
* Authorize handler used to ask remote source authorization
* Register handler used to do user and related linked account creation
2019-03-29 17:53:15 +01:00
Simone Gotti
704da47afc
configstore: createuser also create linked account when requested
...
Useful to future user registration to create user and linked account in a unique
atomic call.
2019-03-29 17:50:51 +01:00
Simone Gotti
3e3a7a0ea5
gateway: move user la and login validation to command layer
2019-03-29 14:33:41 +01:00
Simone Gotti
75b5b65da3
runservice: check that readdb is initialized
2019-03-29 12:20:54 +01:00
Simone Gotti
e46766829c
runservice: rework store and readdb logic
...
* Remove all the small index files on the lts
* Keep on s3 only a full index of all runs containing the runid, grouppath and phase
million of runs can take only some hundred of megabytes
* Periodically create a new dump of the index
2019-03-29 12:15:48 +01:00
Simone Gotti
3c5eb71ba8
runservice: make and check that group paths are absolute
2019-03-29 12:09:32 +01:00
Simone Gotti
48ab496beb
*: add api to query last run per group
2019-03-29 12:00:18 +01:00
Simone Gotti
21447fc59d
etcd: allow specifying a revision for a get
2019-03-29 11:37:22 +01:00
Simone Gotti
1e41e3ad33
gateway/api: report if the run can be restarted
2019-03-29 09:22:34 +01:00
Simone Gotti
c9089c3ccc
runservice: allow restart run only if possible
2019-03-29 09:09:57 +01:00
Simone Gotti
1657a35a6f
runservice: refactor fetch phase check
...
Use dedicated functions
2019-03-29 09:00:19 +01:00
Simone Gotti
7fa14c1b7a
util/path: add PathList function
2019-03-28 16:02:11 +01:00
Simone Gotti
3e9fcf9d7b
wal: add function to return current changes revision
2019-03-28 16:01:33 +01:00
Simone Gotti
975bc810b3
wal: return error when changes isn't initialized
2019-03-28 16:01:08 +01:00
Simone Gotti
65c425b22b
wal: report when wal is ready
...
in this way the wal instance will be used only after it's ready (initialized
etcd when needed)
2019-03-28 15:46:24 +01:00
Simone Gotti
d13fe43e19
wal: fix file close
...
don't defer in a loop
2019-03-28 15:44:14 +01:00
Simone Gotti
805099b693
wal: don't use path.Base to get changegroup value
...
If a changegroup contains a slash then it'll be cut the the last string after
the slash
2019-03-28 15:42:45 +01:00
Simone Gotti
0f9a5f9c4b
wal: send watch events only when needed
2019-03-27 20:40:23 +01:00
Simone Gotti
1e1ba89a3f
wal: remove additionalwalactions
2019-03-27 20:39:59 +01:00
Simone Gotti
61b454d4da
config environment from variable
2019-03-18 15:02:32 +01:00
Simone Gotti
50547a6490
initial secret and variables impl
2019-03-14 14:36:18 +01:00
Simone Gotti
8b92b6f55c
initial project group impl
...
and related api updated
2019-03-14 14:36:18 +01:00
Simone Gotti
3b8a1d684b
configstore: use httpError everywhere
2019-03-14 09:34:05 +01:00
Simone Gotti
8f4a5b29b9
*: implement setup step
2019-03-13 15:48:35 +01:00
Simone Gotti
b05b377d31
runservice: add option to define custom container entrypoint
2019-03-13 12:12:32 +01:00
Simone Gotti
16ac6ada66
runservice: add privileged containers options
2019-03-13 12:11:46 +01:00
Simone Gotti
7d105f1232
configstore: use ErrBadRequest
2019-03-12 15:12:19 +01:00
Simone Gotti
f09602cdc3
*: implement run stop
2019-03-08 10:02:37 +01:00
Simone Gotti
6f38c48066
*: initial implementation of when conditions
2019-03-07 18:01:34 +01:00
Simone Gotti
a4ad66ac2d
gateway: implement initial basic run restart
2019-03-04 16:12:07 +01:00
Simone Gotti
9d2c133817
runservice implement initial basic run restart
2019-03-04 16:11:18 +01:00
Simone Gotti
f383a0056d
gateway gitsources: use owner id for deploy keys and webhook urls
...
In this way we could have multiple projects pointing to the same remote
repository and every projects will have its own deploy key and webhook url
2019-02-28 17:19:53 +01:00
Simone Gotti
41002efbff
*: add organizations
2019-02-28 15:52:35 +01:00
Simone Gotti
e6595b2dba
types: add organizations
2019-02-28 15:53:10 +01:00
Simone Gotti
3c2a06c6b0
Add password utils
2019-02-21 16:04:00 +01:00
Simone Gotti
715596e650
Add user local runs feature
2019-02-21 23:01:17 +01:00
Simone Gotti
6f55ab1d38
Add git save implementation
2019-02-21 16:06:18 +01:00
Simone Gotti
fd486bbe09
gateway: add internal git server repos api
2019-02-22 09:34:48 +01:00
Simone Gotti
203a41eaf7
Add custom git server
2019-02-21 16:03:17 +01:00
Simone Gotti
cae68c6971
Add our own git gitsource
2019-02-21 18:08:09 +01:00
Simone Gotti
021a0465ce
gateway: initial implementation
2019-02-21 17:58:25 +01:00
Simone Gotti
18c4b631bf
Add git utils
2019-02-21 23:14:55 +01:00
Simone Gotti
ba00398009
Add initial git sources implementations
...
* gitea
* gitlab
2019-02-21 16:06:34 +01:00
Simone Gotti
57c756a5a4
configstore: initial implementation
2019-02-21 16:08:30 +01:00
Simone Gotti
bd21f1f9b5
scheduler: initial basic implementation
2019-02-21 16:04:33 +01:00
Simone Gotti
cbe26c5797
Add makefile
2019-02-21 15:59:16 +01:00
Simone Gotti
44173ac473
cmd: initial commit
2019-02-21 15:57:40 +01:00
Simone Gotti
36fc79dfc6
runservice: initial commit
2019-02-21 15:54:50 +01:00
Simone Gotti
4cd382425c
toolbox: initial commit
2019-02-21 15:57:11 +01:00
Simone Gotti
f70dc16738
Add initial agola config format and handling
2019-03-07 14:42:32 +01:00
Simone Gotti
86e8479de9
Add initial objectstorage wal manager
2019-02-22 08:45:59 +01:00
Simone Gotti
02ed2871db
Add errors utils
2019-02-21 16:32:01 +01:00
Simone Gotti
6ef77158e3
Add slice utils
2019-02-21 16:32:27 +01:00
Simone Gotti
11d1920b04
Add time utils
2019-02-21 16:31:48 +01:00
Simone Gotti
2eea5ab8c6
Add dump util
2019-02-21 16:30:34 +01:00
Simone Gotti
981aea1284
Add common services types
2019-02-21 16:04:15 +01:00
Simone Gotti
9daa5c1326
Add internal/common
2019-02-21 16:07:20 +01:00
Simone Gotti
5bdfb4c084
Add common services configuration
2019-02-21 16:05:06 +01:00
Simone Gotti
968104c469
Add database helper
2019-02-21 16:05:54 +01:00
Simone Gotti
7aae1d3e1b
Add initial objectstorage implementation
2019-02-21 16:00:48 +01:00
Simone Gotti
fb022c5992
Add etcd sequence implementation
2019-02-21 16:01:52 +01:00
Simone Gotti
e38ba8ea31
Add etcd store
2019-02-21 16:00:12 +01:00
Simone Gotti
24f4ab6bc0
Add tls util
2019-02-21 16:23:36 +01:00
Simone Gotti
86d5a85409
Add common logging helper
2019-02-21 16:05:35 +01:00