Commit Graph

40 Commits

Author SHA1 Message Date
alessandro.pinna e3da8ab84f runconfig: changed encoded auth with value type for dockerregistryauth 2022-03-01 05:53:32 -08:00
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 87f182a0c9 *: use errors.Is/errors.As to handle wrapped error checking
Enable golangci-lint errorlint linter to check proper use of errors.Is
and error.As instead of direct comparison or error type casting.
2022-02-24 17:07:29 +01:00
Simone Gotti 8a156b936e config: check max config size
limit config size to 1MiB.
2020-03-17 11:28:25 +01: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 1820c0247c config: provide jsonnet context top level argument 2020-03-06 11:19:49 +01:00
Carlo Mandelli 7a51404b71 run config: add tty option for run steps 2019-10-28 16:58:54 +01:00
Simone Gotti 7d62481415 *: implement ability to add tmpfs volumes to containers
* Add a generic container volume option that currently only support tmpfs. In
future it could be expanded to use of host volumes or other kind of volumes (if
supported by the underlying executor)

* Implement creation of tmpfs volumes in docker and k8s drivers.
2019-10-08 16:36:23 +02:00
Carlo Mandelli cd8175c156 add clone options 2019-09-25 09:29:39 +02:00
Simone Gotti 6d7410cfce runservice: remove run step user
Defining an option to override the user for a run step is too much fine grained
and, for consistency, will require to do the same also for the other steps
(clone, *workspace etc...).

Remove it since it's probably enough to define it at the task level.
2019-09-11 15:02:08 +02:00
Simone Gotti 70eeddb719 types: use a global When type
Currently we are using different `When` types for every service and convert
between them. This is a good approach if we want to keep isolated all the
services (like if we were using different repos for every service instead of the
current monorepo).

But currently, since When is identical between all the services, simplify this by
using a common When type.
2019-09-05 09:37:27 +02:00
Simone Gotti 79c74e9423 config: fix check on task and parents with common deps 2019-08-12 23:11:19 +02:00
Simone Gotti db742a6cd6 config: add run when field
Don't create a run if a when condition is defined and it doesn't match.
2019-08-05 16:07:47 +02:00
Simone Gotti c1ff28ef9f *: export clients and related types
Export clients and related packages.

The main rule is to not import internal packages from exported packages.

The gateway client and related types are totally decoupled from the gateway
service (not shared types between the client and the server).

Instead the configstore and the runservice client currently share many types
that are now exported (decoupling them will require that a lot of types must be
duplicated and the need of functions to convert between them, this will be done
in future when the APIs will be declared as stable).
2019-08-02 12:02:01 +02:00
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 3a7ba2694d internal: fix linter errors
Fix errors reported by default golangci-lint linters
2019-07-02 16:20:53 +02:00
Simone Gotti 8d67844cc4 *: use vanity url
use agola.io domain
2019-07-01 11:40:20 +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 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 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 ba5399b97e config/runconfig: add global docker registries auth 2019-05-10 11:45:00 +02:00
Simone Gotti dfeba334f6 runservice: update docker registry auth 2019-04-22 14:38:25 +02:00
Simone Gotti f3e583bb40 config: check Runtime.Arch 2019-04-17 15:24:37 +02:00
Simone Gotti ebe34ba1fa runservice: set default config task working_dir
Set default task working_dir to ~/project
2019-04-16 15:20:45 +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 6066221136 runservice: rename config pipeline(s) to run(s)
No need for different names. We are always talking about a run. In the config
it's the run definition, in the service is the run execution.
2019-04-15 23:42:10 +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 634a8a543c runservice: implement docker registry auth
By now just support default username/password login

In future also support additional container registries with their own credential
helpers
2019-04-10 17:13:51 +02:00
Simone Gotti 298ffc3529 config: generalize and simplify value string/from_variable parsing 2019-04-10 17:12:39 +02:00
Simone Gotti 7d787c5f77 *: implement task approval 2019-04-08 17:29:57 +02:00
Simone Gotti 61b454d4da config environment from variable 2019-03-18 15:02:32 +01:00
Simone Gotti 8b92b6f55c initial project group impl
and related api updated
2019-03-14 14:36:18 +01:00
Simone Gotti b05b377d31 runservice: add option to define custom container entrypoint 2019-03-13 12:12:32 +01:00
Simone Gotti 16ac6ada66 runservice: add privileged containers options 2019-03-13 12:11:46 +01:00
Simone Gotti 6f38c48066 *: initial implementation of when conditions 2019-03-07 18:01:34 +01:00
Simone Gotti 44173ac473 cmd: initial commit 2019-02-21 15:57:40 +01:00
Simone Gotti f70dc16738 Add initial agola config format and handling 2019-03-07 14:42:32 +01:00