Commit Graph

774 Commits

Author SHA1 Message Date
alessandro.pinna c5d240f0d0 runconfig: fix missing generation of dockerregistryauth auth field 2022-03-01 02:32:52 -08:00
Simone Gotti b234ce86a4
Merge pull request #324 from Juneezee/test/t.TempDir
test: use `T.TempDir` to create temporary test directory
2022-03-01 11:26:54 +01:00
Eng Zer Jun 83e66e73f2
test: use `T.TempDir` to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-01 16:37:17 +08:00
Simone Gotti 3c13ae7ba0
Merge pull request #314 from sgotti/fix_cmd_run_list_panic_on_nil_task_exit_status
cmd: fix run list panic on task with nil exit status
2022-02-28 23:22:56 +01:00
Simone Gotti f8bce8a8dc cmd: fix run list panic on task with nil exit status
Fux run list panic on task with nil exit status.
It may happen that a finished task doesn't have an exit status.
2022-02-28 16:35:11 +01:00
Simone Gotti c24d2d014d
Merge pull request #312 from sgotti/tests_dont_start_gitea_for_direct_runs_test
tests: don't start gitea for direct runs test
2022-02-28 16:34:32 +01:00
Simone Gotti 01ea7fa792 tests: don't start gitea for direct runs test
Avoid starting gitea for direct runs tests since it's not used.
2022-02-28 14:26:16 +01:00
Simone Gotti 8fe9196101
Merge pull request #321 from sgotti/use_new_error_library
*: use new errors handling library
2022-02-28 14:23:43 +01: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 5df9ee19c4
Merge pull request #320 from sgotti/use_zerolog
*: use zerolog for logging
2022-02-28 12:48:55 +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 fa7813392c
Merge pull request #313 from sgotti/improve_errors_handling
*: Improve error handling
2022-02-28 10:40:03 +01:00
Simone Gotti c1da3ab566 *: Improve error handling
* Create an APIError that should only be used for api returned errors.
  It'll wrap an error and can have different Kinds and optional code and
  message.
* The http handlers will use the first APIError available in the
  error chain and generate a json response body containing the code and
  the user message. The wrapped error is internal and is not sent in the
  response.
  If no api error is available in the chain a generic internal
  server error will be returned.
* Add a RemoteError type that will be created from remote services calls
  (runservice, configstore). It's similar to the APIError but a
  different type to not propagate to the caller response and it'll not
  contain any wrapped error.
* Gateway: when we call a remote service, by default, we'll create a
  APIError using the RemoteError Kind (omitting the code and the
  message that usually must not be propagated).
  This is done for all the remote service calls as a starting point, in
  future, if this default behavior is not the right one for a specific
  remote service call, a new api error with a different kind and/or
  augmented with the calling service error codes and user messages could
  be created.
* datamanager: Use a dedicated ErrNotExist (and converting objectstorage
  ErrNotExist).
2022-02-25 16:11:19 +01:00
Simone Gotti b357cdc4ed
Merge pull request #319 from sgotti/handle_wrapped_errors_comparison
*: use errors.Is/errors.As to handle wrapped error checking
2022-02-25 09:00:28 +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 e11315764b
Merge pull request #315 from sgotti/update_golangci_lint
ci: update golangci-lint to v1.44.2
2022-02-24 17:07:11 +01:00
Simone Gotti bed726f2d2 ci: update golangci-lint to v1.44.2
Fix errors reported by new/updated linters
2022-02-24 15:22:39 +01:00
Simone Gotti 0e8f1c87f6
Merge pull request #317 from sgotti/gateway_use_dedicated_auth_context_keys_type
gateway: use dedicated auth context keys type
2022-02-24 15:22:19 +01:00
Simone Gotti b7c797bde1 gateway: use dedicated auth context keys type
Use auth context keys dedicated type instead of strings and avoid code
duplication by moving shared code under a common package.
2022-02-24 13:41:57 +01:00
Simone Gotti a1997490e7
Merge pull request #299 from tulliobotti64/16277-filter_user_by_organization
gateway: add api to get authenticated user organizations
2022-02-23 17:42:11 +01:00
Tullio 7160194104 gateway: add api to get authenticated user organizations
gateway: add api to get authenticated user organizations

gateway: add api to get authenticated user organizations
2022-02-23 15:31:34 +01:00
Simone Gotti 699e4a78b6
Merge pull request #311 from sgotti/use_maintained_go_uuid_package
go.mod: replace https://github.com/satori/go.uuid
2022-02-22 10:24:03 +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 d0d219cbf1
Merge pull request #305 from alessandro-sorint/gitea
ci: update gitea to v1.15.11
2022-02-15 10:06:33 +01:00
alessandro.pinna aa65b93342 ci: update gitea to v1.15.11 2022-02-08 15:07:42 +01:00
Simone Gotti 60817871dd
Merge pull request #284 from alessandro-sorint/repo-cleaner
gitserver: add cleanup of old repos/branches
2022-02-08 14:35:33 +01:00
alessandro.pinna 9251a2a046 enhancement: automatic cleanup of old repos/branches 2022-02-08 11:34:23 +01:00
Simone Gotti 40bc118a1b
Merge pull request #302 from alessandro-sorint/test_on_skipped
runconfig: test task generation with on_skipped dependencies
2022-02-01 11:38:52 +01:00
alessandro.pinna e517e4d243 runconfig: test task generation with on_skipped dependencies 2022-02-01 10:01:54 +01:00
Simone Gotti 31b1547020
Merge pull request #290 from raeyulca/on-skipped-fix
runconfig: add case statement for on_skipped
2022-01-19 11:36:38 +01:00
raeyulca 88bef4480d add missing case statement 2022-01-18 23:14:50 -08:00
Simone Gotti 87874961a9
Merge pull request #279 from alessandro-sorint/master
config: fix executor ActiveTasksLimit yaml tag
2021-10-11 11:16:41 +02:00
alessandro.pinna e600ca078e config: fix executor ActiveTasksLimit yaml tag 2021-10-11 09:48:25 +02:00
Simone Gotti 96ff1473a3
Merge pull request #276 from sgotti/migrate_to_golang-jwt
*: migrate to golang-jwt/jwt
2021-09-10 14:38:53 +02: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 97ee680b72
Merge pull request #273 from ygbillet/gitea-fix-list-repo
fix: gitea fetch remote repository with pagination
2021-06-07 09:36:42 +02:00
Yves-Gaël Billet 3dbf9a923f fix: gitea fetch remote repository with pagination
Actual implementation doesn't fetch all repository. Gitea API has
pagination.

This patch works wwith gitea pagination for repository listing

Signed-off-by: Yves-Gaël BILLET <yg.billet@gmail.com>
2021-06-04 23:17:41 +02:00
Simone Gotti 8b7596559b
Merge pull request #271 from sgotti/executor_add_initimage_auth_options
executor: add init image config authentication options
2021-05-26 11:25:25 +02:00
Simone Gotti d9d6b995da executor: add init image config authentication options
Add config options to define docker registry authentication for init image
pulling.
2021-05-26 08:57:21 +02:00
Simone Gotti 42a07856cc
Merge pull request #270 from sgotti/executor_use_busybox_stable_as_default_init_image
executor: use busybox:stable as default init image
2021-05-25 22:47:16 +02:00
Simone Gotti afece4d846 executor: use busybox:stable as default init image
Use "busybox:stable" as default init image name so it won't be checked/pulled
any time.
2021-05-25 14:03:55 +02:00
Simone Gotti 875e118817
Merge pull request #269 from sgotti/executor_docker_pull_initimage_only_when_needed
executor/docker: pull init image only when needed
2021-05-25 14:02:41 +02:00
Simone Gotti b403fd558a executor/docker: pull init image only when needed
Use the same logic of k8s and pull init image only when has the latest (or
empty) tag or it doesn't exist.
2021-05-25 12:59:16 +02:00
Simone Gotti 0b0d05f2a0
Merge pull request #268 from sgotti/executor_add_config_option_initimage
executor: add config option to define the init image
2021-05-25 12:58:33 +02:00
Simone Gotti 21a63af6f5 executor: add config option to define the init image
* Add an executor config option to define the init image to use.
2021-05-25 11:46:44 +02:00
Simone Gotti a7f55f5344
Merge pull request #259 from sgotti/release_v0.6.0
Release v0.6.0
2021-03-24 13:03:42 +01:00
Simone Gotti 6da55293e4 Release v0.6.0 2021-03-19 16:35:05 +01:00
Simone Gotti 43d73ec064
Merge pull request #261 from sgotti/add_listenandservetls
*: call ListenAndServeTLS when tls is enabled in config
2021-03-19 12:25:07 +01:00
Simone Gotti 0544586ade *: call ListenAndServeTLS when tls is enabled in config 2021-03-19 10:53:16 +01:00
Simone Gotti 291ed3d440
Merge pull request #257 from sgotti/update_to_go_1.16
*: update to go 1.16
2021-03-16 13:44:43 +01:00