Commit Graph

190 Commits

Author SHA1 Message Date
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