Commit Graph

40 Commits

Author SHA1 Message Date
Simone Gotti d2b09d854f *: use new errors handling library
Implement a new error handling library based on pkg/errors. It provides
stack saving on wrapping and exports some function to add stack saving
also to external errors.
It also implements custom zerolog error formatting without adding too
much verbosity by just printing the chain error file:line without a full
stack trace of every error.

* Add a --detailed-errors options to print error with they full chain
* Wrap all error returns. Use errors.WithStack to wrap without adding a
  new messsage and error.Wrap[f] to add a message.
* Add golangci-lint wrapcheck to check that external packages errors are
  wrapped. This won't check that internal packages error are wrapped.
  But we want also to ensure this case so we'll have to find something
  else to check also these.
2022-02-28 12:49:13 +01:00
Simone Gotti d1b4ab4296 *: use zerolog for logging
Replace zap with zerolog.

zerolog has a cleaner interface and can be easily configured with custom
error chain printing using a new error handling library that will be
implemented in another PR.
2022-02-28 10:40:55 +01:00
Simone Gotti 576c09775f go.mod: replace https://github.com/satori/go.uuid
Replace https://github.com/satori/go.uuid with maintained version at
https://github.com/gofrs/uuid

Since the new version uuid.NewV4 returns an error when failing to read
from the random source reader we use uuid.Must to panic on error since
it's considered an unrecoverable error.

In future, if needed, we could handle the error instead of panicking.
2022-02-21 09:43:32 +01:00
Simone Gotti 64680468fd *: migrate to golang-jwt/jwt
Migrate to the new community maintained version of github.com/dgrijalva/jwt-go
2021-09-10 12:33:59 +02:00
Simone Gotti d3a5fbfe5b *: update to go 1.16 2021-03-15 15:17:29 +01:00
6543 cc52d49d6b
update code.gitea.io/sdk/gitea v0.11.0 -> v0.12.0 2020-05-22 11:49:30 +02:00
Simone Gotti d91ec09d7d config: add starlark config support
Handle `.agola/config.star` files in starlark config format.
To provide a context like done for jsonnet we require that the starlark agola
config file contains a main function that will receive a config context as a
dict.
We also had to implement our own json conversion from a starlark dict since go
starlark removed its own function.
2020-03-10 13:29:20 +01:00
Simone Gotti ed53183431 go.mod: update dependencies
Update all the updatable dependencies
2020-02-18 13:55:50 +01:00
6543 f92619d423
vendor: update gitea sdk 2020-02-06 18:56:46 +01:00
MitaliBo 5fa977d05a
Update go.mod 2020-01-15 11:57:45 -08:00
Simone Gotti e18794764e go.mod: update dependencies
Update all the updatable dependencies
2019-10-29 09:31:38 +01:00
Simone Gotti 6dd9a12e87 *: update to go 1.13
* agola run: Remove go 1.11 and use go 1.12 and go 1.13 with debian buster image.

* Dockerfile: Use go 1.13 debian buster image.
2019-09-10 14:08:55 +02:00
Simone Gotti 2800f6cd6e go mod: update golang.org/x/xerrors 2019-07-24 15:23:33 +02:00
Simone Gotti cf0b7f8ded add initial integration tests 2019-05-29 13:35:20 +02:00
Simone Gotti 8d67844cc4 *: use vanity url
use agola.io domain
2019-07-01 11:40:20 +02:00
Simone Gotti 580746d7f1 gitsource: update gitea client 2019-06-11 10:29:06 +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 b22c197fef gitsources: add github gitsource 2019-05-15 23:46:21 +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 e0d37b08f2 runservice: add k8s driver 2019-04-22 17:54:24 +02:00
Simone Gotti dfeba334f6 runservice: update docker registry auth 2019-04-22 14:38:25 +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 4c12b03544 toolbox: expand archive/unarchive starting tilde
Expand archive sourceDir(s) and unarchive DestDir
2019-04-13 14:56:35 +02:00
Simone Gotti c300a37d09 runservice: add some initial scheduler tests 2019-04-11 17:23:59 +02:00
Simone Gotti 8b92b6f55c initial project group impl
and related api updated
2019-03-14 14:36:18 +01:00
Simone Gotti 4cacae198f go.mod: update gorilla mux version 2019-03-18 15:05:43 +01:00
Simone Gotti 021a0465ce gateway: initial implementation 2019-02-21 17:58:25 +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 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 86e8479de9 Add initial objectstorage wal manager 2019-02-22 08:45:59 +01:00
Simone Gotti 2eea5ab8c6 Add dump util 2019-02-21 16:30:34 +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 e38ba8ea31 Add etcd store 2019-02-21 16:00:12 +01:00
Simone Gotti 86d5a85409 Add common logging helper 2019-02-21 16:05:35 +01:00