Commit Graph

29 Commits

Author SHA1 Message Date
Simone Gotti fd26e617b3 configstore: move configstore types inside configstore package
Since they're not types common to all the services but belongs to the
configstore.

Next step will be to make them local to the configstore and not directly used by
other services since these types are also stored.
2019-08-02 10:05:47 +02:00
Simone Gotti d0c5621201 util: remove time.go
The same function is already provided by pointer.go
2019-08-01 14:14:56 +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 3a7ba2694d internal: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 16:20:53 +02:00
Simone Gotti f7faab353e git util: fix Get/SetConfig error reporting 2019-06-11 12:46:41 +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 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 8331c43a18 util errors: add ErrUnauthorized 2019-05-13 14:20:31 +02:00
Simone Gotti 5a50a2681d util/errors: add ErrForbidden 2019-05-03 23:18:51 +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 da2ac0ab38 util: add path functions
add IsParentPath and IsSameOrParent path functions and related tests
2019-04-30 16:24:04 +02:00
Simone Gotti 90d129750d util: add pointer utils 2019-04-24 16:31:14 +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 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 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 7fa14c1b7a util/path: add PathList function 2019-03-28 16:02:11 +01:00
Simone Gotti 61b454d4da config environment from variable 2019-03-18 15:02:32 +01:00
Simone Gotti 7d105f1232 configstore: use ErrBadRequest 2019-03-12 15:12:19 +01:00
Simone Gotti 3c2a06c6b0 Add password utils 2019-02-21 16:04:00 +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 36fc79dfc6 runservice: initial commit 2019-02-21 15:54:50 +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 24f4ab6bc0 Add tls util 2019-02-21 16:23:36 +01:00