Commit Graph

484 Commits

Author SHA1 Message Date
Simone Gotti
fafa5188c2 configstore: maintenance/export/import
Implement configstore maintenance mode and export/import.

When configstore is set in maintenance mode it'll start only the maintenance and
export/import handlers.

Setting maintenance mode will set a key in etcd so all the configstore instances
will detect it and enter in maintenance mode. This is done asyncronously so it
could take some time (future improvements will add some api to show all the
configstore states)

Export is always available and will export the datamanager contents.

Import is available only during maintenance, given a datamanager export will
import it and reset etcd to this import state.
2019-07-26 10:55:04 +02:00
Simone Gotti
f3fa229f6c util: add GoWait function
GoWait will increase the provided waitGroup on start and execute a goroutine
that will run the provided functions and then decrease the waitGroup
2019-07-26 10:55:04 +02:00
Simone Gotti
bd035e9840 util: use context in backoff 2019-07-26 10:36:11 +02:00
Simone Gotti
ceafc2ef98 readdb: close and open readdb on Run 2019-07-25 17:59:54 +02:00
Simone Gotti
6f3798e8fe *: use sleep timer in loops
So we'll react instantly to a context cancel instead of waiting on time.Sleep
returning.
2019-07-25 16:22:54 +02:00
Simone Gotti
b8c2b4020a db: use context functions
Use the go sql context functions (ExecContext, QueryContext etc...)

The context is saved inside Tx so the library users should only pass it one time
to the db.Do function.
2019-07-25 14:49:53 +02:00
Simone Gotti
3404cb94b9 datamanager: implement import/export
* export: exports the newest data checkpoint. It forces a checkpoint before
exporting (currently no wals are exported)

* import: cleans up etcd, creates a new datasnaphot from the provided import stream
and then initializes etcd. Currently no old data is removed from the object
storage but it's just ignored.
2019-07-25 11:12:49 +02:00
Simone Gotti
3987caf664 datamanager: implement maintenance mode
when datamanager is started in maintenance mode no goroutines are scheduled and
no initial etcd initialization is done
2019-07-24 17:37:27 +02:00
Simone Gotti
3297244d5d db: retry on sqlite locked error
Since we are using the shared cache with the lock notify we won't receive
SQLITE_BUSY errors but we could receive SQLITE_LOCKED errors due to deadlocks or
locked tables on concurrent read and write transactions.

This patch catches this kind of errors and retries the tx until maxTxRetries.
2019-07-24 12:20:33 +02:00
Simone Gotti
77ee8d9e7d
Merge pull request #58 from sgotti/readdb_fix_deadlock
readdb: fix deadlock in Run method
2019-07-23 15:47:05 +02:00
Simone Gotti
85876310af readdb: fix deadlock in Run method
In runservice readdb Run method we could end with a deadlock if two of the
goroutines that call HandleEvents.* try to write to the errCh at the same
time before the errCh is read. If this happens one of the two will be blocked on
writing to the channel but the read won't happen since it'll blocked by
wg.Wait().

Fix this doing:
* use a buffered channel large as the number of executed goroutines.
* create a new errCh at every loop (so we'll ignore later errors after the first
one)

Note: we could also use a non blocking send to avoid this situation but we
should also start the wg.Wait before the goroutines or earlier errors could be
lost causing another kind of hang.
2019-07-23 14:56:26 +02:00
Simone Gotti
75d68b2b52 runservice: stop run also if result is not set 2019-07-23 12:11:01 +02:00
Simone Gotti
3a963ef95f readdb: error if there's no wal in etcd 2019-07-18 16:44:28 +02:00
Simone Gotti
3f64bda0cc readdb: save walSequence provided by data file 2019-07-18 16:44:28 +02:00
Simone Gotti
16820e9033 readdb: insert current wal sequence after checking wal status 2019-07-18 16:44:28 +02:00
Simone Gotti
f7175c4592 datamanager: save previous wal in waldata 2019-07-18 16:44:28 +02:00
Simone Gotti
18c5ae0492 datamanager: error if there're wals but not a datastatus in ost 2019-07-18 16:44:28 +02:00
Simone Gotti
c034819087 datamanager: accept optional datastatus in initEtcd 2019-07-18 16:44:28 +02:00
Simone Gotti
df716fccc6 datamanager: create a new wal and checkpoint in initEtcd
When doing an initEtcd (new instance or etcd reset) create a new wal (that will
have a new sequence epoch) and do a checkpoint.

In this way:

* readdb will detect that an epoch change and do a full resync
* we always have a data file (also if empty) that provides the last checkpointed
wal. This information could be used by readdb to resync
2019-07-18 16:44:28 +02:00
Simone Gotti
cb2a871be6 datamanager: start initEtcd from last datastatus 2019-07-18 16:44:28 +02:00
Simone Gotti
445ef24daa datamanager: add option to force a checkpoint 2019-07-18 16:44:27 +02:00
Simone Gotti
512162bf98 datamanager: clean etcd data before reinitialization 2019-07-18 16:42:17 +02:00
Simone Gotti
8fbb9fdcbe datamanager: add deleteEtcd method 2019-07-18 16:40:28 +02:00
Simone Gotti
21964f90fd etcd: add DeletePrefix method 2019-07-18 16:40:28 +02:00
Simone Gotti
86d822a247 service: handle cors config and use it only on gateway
* Don't make cors enabled on all (*) by default.
* Handle related web.allowedOrigins options
* Only the gateway api should be called by a browser so setup the cors handler
only on it
2019-07-13 23:15:00 +02:00
Simone Gotti
5483620fb0 gateway: return project if the project is public
If the project is public don't require the user to be logged in to show the
project.
2019-07-12 23:41:34 +02:00
Simone Gotti
cf0b7f8ded add initial integration tests 2019-05-29 13:35:20 +02:00
Simone Gotti
b80710e2f0 k8s driver: start goroutines after setup 2019-07-10 21:55:26 +02:00
Simone Gotti
940264e413 runservice: add lock around compatchangegroups
just to avoid concurrency errors when multiple instances are running
2019-07-10 10:20:35 +02:00
Simone Gotti
c064e490b2 datamanager: add lock around compatchangegroups and initetcd
just to avoid concurrency errors when multiple instances are running
2019-07-10 10:20:03 +02:00
Simone Gotti
276c045c3b configstore: add parenttype to related tables
Add the parenttype column to project, projectgroup, secret, variable tables.
2019-07-09 10:16:45 +02:00
Simone Gotti
8b7a5602e0 configstore: fix project/projectgroup rename
project: check name exists only if the name has changed
projectgroup: add missing duplicate name check
2019-07-08 18:12:42 +02:00
Simone Gotti
25322a6d81 github: fix retrieving commit sha for signed tags
if a tag is a signed tag, github's hook.After points to the signed tag object
sha and not the related commit sha. In this case use hook.HeadCommit.ID.
2019-07-08 17:21:24 +02:00
Simone Gotti
11a2ff48d6 runservice: delete executor task early
currently we are deleting the executor tasks only when all the run tasks
log/archives were fetched. But it'll better to remove a single executor task
when the task fetching is finished.

This could also fix possible issues on k8s since we are scheduling tasks but the
k8s scheduler may not schedule them if there aren't enough resources causing a
scheduling deadlock since we won't remove finished pods because their related
tasks are not removed and k8s cannot start new pods since it has no resources.
2019-07-08 16:03:14 +02:00
Simone Gotti
7aea06fce8 k8s driver: use right node selector on old k8s versions
Before kubernetes 1.14 nodes were labeled with the "beta.kubernetes.io/arch"
label instead of the "kubernetes.io/arch".

Current k8s version (v1.15) labels nodes with both labels but it's
deprecated and will removed in future versions.

At driver start get the current k8s api version and choose the right label to
use as node selector based on it.
2019-07-08 13:51:31 +02:00
Simone Gotti
34d36e9e24 gateway: implement secret update 2019-07-08 10:32:45 +02:00
Simone Gotti
289e691a58 configstore: implement secret update 2019-07-08 10:32:32 +02:00
Simone Gotti
45a460ebc0 runservice: handle run not existing
Check if the response from the readdb is null and return an http not found error
2019-07-08 09:30:15 +02:00
Simone Gotti
49c1c263fd gateway: implement variable update 2019-07-06 15:25:45 +02:00
Simone Gotti
ac0c1fc2bd configstore: implement variable update 2019-07-06 15:25:24 +02:00
Simone Gotti
28c44ce1fc configstore: update/fix remotesource rename
* Override the provided remotesource id with the current one (it could not be
provided or provided with a different id but the remotesource ref is the way to
get the current remote source).

* When changing remotesource name check that a remote source with the new name
does not already exist.
2019-07-06 14:40:31 +02:00
Simone Gotti
2c042fb4bd configstore: add remote source tests 2019-07-06 14:39:37 +02:00
Simone Gotti
ee5c829653 *: add remote source option to disable registration/login
* Make the new fields RegistrationEnabled/LoginEnabled in types.RemoteSource
bool pointers (since they are new fields that don't exist in previously saved
remote sources) and default them to true if null when unmarshaling (or existing
remotesources will have registration and login disabled)

* Add options to cmd remotesource create/update to set the registration/login
disabled.
2019-07-05 13:33:29 +02:00
Simone Gotti
e7864d0d84 gateway: add getruns filter by result 2019-07-05 10:42:45 +02:00
Simone Gotti
04ef20464d runservice: add getruns filter by result 2019-07-05 10:32:51 +02:00
Simone Gotti
929a6fb654 service/*: log error only if nil 2019-07-04 15:50:37 +02:00
Simone Gotti
0ec0a37fa3 config: remove unused gatewayURL from gitserver config 2019-07-04 10:55:12 +02:00
Simone Gotti
ea025638ff configstore: set base path for datamanager
Don't put datamanager base dirs inside the root of the ost but use a base path.

Let's do it now before releasing since this is a breaking change that requires
moving the ost data to the new path
2019-07-03 17:19:40 +02:00
Simone Gotti
5db23410d0 runservice: set base path for datamanager
Don't put datamanager base dirs inside the root of the ost but use a base path.

Let's do it now before releasing since this is a breaking change that requires
moving the ost data to the new path
2019-07-03 17:18:21 +02:00
Simone Gotti
d989fe9639 datamanager: always handle basepath
Currently we aren't setting a basepath and it wasn't always correctly handled.
Fix missing basepath handling and improve tests to also use a non empty
basepath.
2019-07-03 17:03:37 +02:00
Simone Gotti
abab40c6f5 gateway/cmd: generate CacheGroup for user direct runs
Since the user direct runs all belong to the same run group (the user id) all
the user direct runs will share the same caches. To distinguish between the
different caches we need to use something in addition to the user id. In this
case we are usin the local repo uuid generated by the direct run start command.
2019-07-03 15:19:52 +02:00
Simone Gotti
87a472aaaf runservice: add CacheGroup field to runconfig
The cache group fields defines under which cache group the run cache data will
belong. This is needed/useful for some next changes:

* Make cache correctly work for user direct runs. Since the user direct runs all
belong to the same run group (the user id) all the use direct runs will share the
same caches. To distinguish between the different caches we need to use something
in addition to the user id (the local repo uuid generated by the direct run
start command)
* Share the cache between multiple projects
2019-07-03 15:16:37 +02:00
Simone Gotti
3a7ba2694d internal: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 16:20:53 +02:00
Simone Gotti
8ef3c1d9b3 gitsources: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 16:10:39 +02:00
Simone Gotti
f80cb15cd6 scheduler: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 15:56:14 +02:00
Simone Gotti
e508993d93 notification: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 15:54:47 +02:00
Simone Gotti
f1908c3a16 configstore: sync readdb run method with the one of runservice 2019-07-02 15:44:33 +02:00
Simone Gotti
5643dd5dcd configstore: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 14:46:00 +02:00
Simone Gotti
c5abbee3d8 gateway: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 15:35:14 +02:00
Simone Gotti
f152b6a6da executor: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 15:18:52 +02:00
Simone Gotti
19793db0c2 runservice: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 14:53:01 +02:00
Simone Gotti
49d0238a1e datamanager: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 14:27:51 +02:00
Simone Gotti
5c2bf8642f gateway: show run/tasks/steps if the project is public
If the project is public don't require the user to be logged in to show the
run/tasks/logs
2019-07-01 16:40:02 +02:00
Simone Gotti
8d67844cc4 *: use vanity url
use agola.io domain
2019-07-01 11:40:20 +02:00
Simone Gotti
0c30839f5c gateway: cleanup remote repo on project delete 2019-06-14 15:17:19 +02:00
Simone Gotti
f2be16ce4d gateway: cleanup project if remote setup fails
If the remote setup steps fails (create webhook and deploy key) try to delete
project and cleanup remote repo.
2019-06-14 14:57:59 +02:00
Simone Gotti
5e21089baa *: remove unneeded logging
remove many log.Info entries that where old debugging entries and move some of
them to the Debug level.
2019-06-14 11:28:00 +02:00
Simone Gotti
5c911523c5 sentinel: skip executor that don't allow privileged containers
if they are requested.
2019-06-13 18:32:56 +02:00
Simone Gotti
0296d594b5 executor: add option to allow privileged containers
* add a config option allowPrivilegedContainers
* fail task setup if privileged containers are requested but they aren't
allowed.
* report if privileged containers are allowed to the runservice
2019-06-13 18:31:08 +02:00
Simone Gotti
57446f7dcd executor: fix task status update when runservice is unavailable
* don't remove the runningTask when executeTask finishes but just mark the
runningTask a not executing
* add a loop to periodically update executorTask status and remove the
runningTask if not executing and status update was successful
* remove runningTask when it disappears from the runservice
2019-06-13 12:39:34 +02:00
Simone Gotti
d6feb10e8f executor: rename/refactor executeTasksInternal to executeTaskSteps
* directly pass runningTask instead of executorTask
2019-06-13 12:34:31 +02:00
Simone Gotti
a53e14b4e8 runservice: check if executor is alive before scheduling tasks
Check that the last update time is less than 1 minute (currently hardcoded)
2019-06-12 18:12:37 +02:00
Simone Gotti
11ae921364 docker driver: allow multiple executors on same docker daemon
This is useful primarily for testing purposes.

Add an executorID label to created container to filter out containers not
matching our executorID.
2019-06-12 17:29:43 +02:00
Simone Gotti
629cf2be82 executor: reuse taskPath function 2019-06-12 16:16:53 +02:00
Simone Gotti
48411f4c64 gateway: move webhook inside api package 2019-06-11 17:07:08 +02:00
Simone Gotti
5876c54837 git-handler: handle client requests with gzip Content Encoding 2019-06-11 17:05:07 +02:00
Simone Gotti
5a74ebf9d8 *: remove agola git hook
* Delete the command and it's rule in the Makefile
* Don't use it inside gitserver and remove related config option (also from
examples)
* Remove webhook parsing from agolagit gitsource
2019-06-11 15:30:09 +02:00
Simone Gotti
369f116bfc gateway webhook: remove handling of user direct runs 2019-06-11 15:17:08 +02:00
Simone Gotti
2a95c93f0d gateway: add UserCreateRun api and related action
add an api to execute a user direct run. This method will replace the current
custom webhook way to create a direct run.
2019-06-11 15:09:41 +02:00
Simone Gotti
810abaaab8 git-save: return commitSHA 2019-06-11 15:04:34 +02:00
Simone Gotti
853082d4f5 git-save: make ref prefix configurable
and add a method to return it
2019-06-11 15:04:01 +02:00
Simone Gotti
f7faab353e git util: fix Get/SetConfig error reporting 2019-06-11 12:46:41 +02:00
Simone Gotti
cff6b8d531 *: rename user local run to user direct run 2019-06-11 12:09:57 +02:00
Simone Gotti
98c2f76f5d gateway: add manual run creation
Add an API and related action to manually create a run from a git branch/tag/ref
with optional commitSHA.

Currently only branches and tags are supported (no pull requests).
If not commitSHA is provided the commit sha referenced by the provided branch/tag/ref is
used.
2019-06-11 11:08:40 +02:00
Simone Gotti
fafcf3a623 gitsource: add new methods to handle refs and commits
Add new methods to handle refs and commits and related urls
2019-06-11 11:07:39 +02:00
Simone Gotti
47b7c5040f gitsource: add repoinfo HTMLURL 2019-06-11 11:07:12 +02:00
Simone Gotti
6e8d467c80 util: add ErrInternal
ErrInternal is an internal error that should be provided to the user (http api
will return a 500 with the error message)

It'll be used for any kind of error that are not auth or bad requests (like
errors to communicate to another service)
2019-06-11 10:59:21 +02:00
Simone Gotti
580746d7f1 gitsource: update gitea client 2019-06-11 10:29:06 +02:00
Simone Gotti
8242dc3a9d gateway: move create run to own action
* Move all run creation logic to the action handler.
* Cleanup webhook to use it
2019-06-11 09:31:12 +02:00
Simone Gotti
5b22ebc2d3 webhook: add run creation trigger type 2019-06-10 17:04:50 +02:00
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
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
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
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
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