Commit Graph

721 Commits

Author SHA1 Message Date
Simone Gotti
1938c2daaf webhook: use runRefType instead of webhook Event 2019-06-10 16:52:51 +02:00
Simone Gotti
28ddfb1781 webhook: add runRefType and convert webhook event
Introduce a runRefType that represent the ref type of the Run (branch/tag/PR)
Convert the webhook event type to the runRefType and use it to generate the run
group.
2019-06-10 16:49:39 +02:00
Simone Gotti
38b54b092c webhook: remove annotation virtual branch 2019-06-10 16:37:32 +02:00
Simone Gotti
863277af2d runservice types: refactor unmarshal
* Don't use a complex UnmarshalJSON for RunConfigTask and ExecutorTask but
introduce a Steps type as a slice of Step (where Step is an empty interface)
and declare an UnmarshalJSON method on the Step type.
2019-06-08 16:30:36 +02:00
Simone Gotti
96c0fa9aea config: refactor config unmarshal
* Don't use a complex UnmarshalJSON for Task but use specific UnmarshalJSON for
every type that requires custom unmarshaling
2019-06-08 16:07:15 +02:00
Simone Gotti
aad661adc8 gateway: don't use maxBytesHandler in gitserver proxy handler
a git object could much be greater than 1MiB.
2019-06-08 16:26:22 +02:00
Simone Gotti
22bd181fc8 datamanager: implement data files splitting
split data files in multiple files of a max size (default 10Mib)
In this way every data snapshot will change only the datafiles that have some
changes instead of the whole single file.
2019-06-03 16:17:27 +02:00
Simone Gotti
8e4555373d objectstorage: honor write size in posix objectstorage 2019-06-05 14:56:56 +02:00
Simone Gotti
6d095cbe50 readdb: ensure that we apply only etcd committed wals
Ensure that we apply only etcd commited wals to avoid doing an unuseful insert
when the wal becomes committed storage.
2019-06-03 18:02:09 +02:00
Luigi Leoni
51a5594c89 gitlab: check getFile exists before content encoding 2019-05-29 15:51:34 +02:00
Simone Gotti
5c4dff0fd9 webhook: export git branch and tag env vars
export AGOLA_GIT_BRANCH and AGOLA_GIT_TAG env vars. They will be mutually empty
if on a branch or tag.
2019-05-24 16:17:00 +02:00
Simone Gotti
42f578a0b5 config: add more validations to task steps 2019-05-24 11:57:10 +02:00
Simone Gotti
7658c44694 config: make runtime type pod the default
In this way users are not forced to always set it in the config file.
2019-05-23 23:23:54 +02:00
Simone Gotti
c0a165de31 runservice: fix query when grouping by path
When grouping by group path we have to apply the filter to the group by using
HAVING and not using WHERE
2019-05-23 23:21:45 +02:00
Simone Gotti
03a0d38b10 gateway: update and log errors on remoterepo api 2019-05-23 17:30:20 +02:00
Simone Gotti
51945513bf gitsources: list only repo with enough permissions
ListUserRepos will return only repos where the user has enough permissions to
create webhooks and deploy keys
2019-05-23 16:58:20 +02:00
Simone Gotti
4d7605a86b gateway: improve ErrFromRemote handling
Don't create an ErrFromRemote wrapping the returned error but
wrap the ErrFromRemote

Also use xerrors Is/As to get the underlying error to return to api clients
while maintaining context for logging
2019-05-23 12:59:11 +02:00
Simone Gotti
9b2ce717c7 *: migrate to "golang.org/x/xerrors"
Just a raw replace of "github.com/pkg/errors".

Next steps will improve errors (like remote errors, api errors, not exist errors
etc...) to leverage its functionalities
2019-05-23 11:23:14 +02:00
Simone Gotti
8f1225da76 *: implement remote source update 2019-05-23 10:29:03 +02:00
Simone Gotti
933dfae658 cmd/api: add skipVerify remote source option
Add an option to set skipVerify on remote source to disable tls cert
verification on remote source api endpoint
2019-05-22 16:28:42 +02:00
Simone Gotti
dd17e7bc14 Dockerfile: add git hook and git in agola image 2019-05-22 12:49:34 +02:00
Simone Gotti
b8bdd096fe gitea: don't check webhook signature if not sent
old versions of gitea doesn't provide a webhook signature but just the secret in
the payload

TODO(sgotti) check the payload secret in this case
2019-05-22 11:39:27 +02:00
Simone Gotti
b3867fb7ca objectstorage: add posix standard storage
rename the previous posix storage to posixflat and make it currently not user
selectable (since I'm not sure it's really worth using it).

The new posix storage uses the filesystem without any escaping so it's not a
real flat namespace.

This isn't a real issue since also minio is not a flat namespace and we are so
forced to use it like a hierarchycal filesystem.
2019-05-21 15:17:53 +02:00
Simone Gotti
0e10a406f9 *: remove server sent events from logs handlers
Just use basic http streaming and send all the data as it's available without
splitting by new lines
2019-05-19 14:35:04 +02:00
Simone Gotti
b5f2281d07 agolademo: update config to use correct web url
In the agola demo the api and web urls are the same (with the same port)
2019-05-16 10:17:47 +02:00
Simone Gotti
c02ed89d6e webbundle: give preference to generated config.js 2019-05-16 10:05:32 +02:00
Simone Gotti
30f398e361 gateway: move login/oauth endpoints under /api
In this way, when bundling the web interface inside the agola binaries, oauth2
redirect to the web interfaces will be served by the webbundle handler and
return the web SPA and not resolve directly the /oauth2/callback api call.
2019-05-16 10:05:21 +02:00
Simone Gotti
b22c197fef gitsources: add github gitsource 2019-05-15 23:46:21 +02:00
Simone Gotti
eabf6c8a92 gateway: fix wrong error message 2019-05-15 23:22:05 +02:00
Simone Gotti
faded9b809 docker driver: handle already deleted containers
don't expect that all the containers of a pod are available. Some could be
already be removed. Improve the logic of sorting containers by their index.
2019-05-15 15:55:08 +02:00
Simone Gotti
821e371cd8 executor: don't start task if max tasks limit has been reached 2019-05-15 15:06:46 +02:00
Simone Gotti
e2bee03a06 gateway api: return if run is stopping 2019-05-15 14:49:46 +02:00
Simone Gotti
bda7a3eb8b *: add run cancel action
and remove unused change phase to finished
2019-05-15 14:42:50 +02:00
Simone Gotti
9cafc36a0d notification service: initial implementation 2019-05-15 10:17:20 +02:00
Simone Gotti
2d6ddd0e74 gitsources: add commit status of type error 2019-05-15 11:26:50 +02:00
Simone Gotti
81d557d785 runservice: add runEvents handler 2019-05-15 09:46:21 +02:00
Simone Gotti
ac893f1c91 runservice: trigger run event in change run phase action 2019-05-15 09:41:56 +02:00
Simone Gotti
846567b96a etcd: add WatchKey function 2019-05-15 09:41:06 +02:00
Simone Gotti
b95fb98f3c runservice: move RunEvent to types 2019-05-15 09:40:32 +02:00
Simone Gotti
02e0deec15 service: move gateway/common to common
Yes, I know that common and utils are bad package names...
2019-05-15 09:38:27 +02:00
Simone Gotti
6c11ab0596 *: implement update projectgroup 2019-05-14 17:53:48 +02:00
Simone Gotti
749109cd75 cmd: add org member list command 2019-05-14 12:56:38 +02:00
Simone Gotti
7d6223ccd4 gateway: add get org members api/action 2019-05-14 12:58:29 +02:00
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