Commit Graph

881 Commits

Author SHA1 Message Date
Chlins Zhang f21b1481bb
refactor: refactor the old goroutine execution sweep (#18361)
refactor: refactor the old goroutine execution sweep to global execution sweep job

1. Delete the old goroutine execution sweeper when create execution.(in the case of high concurrency can cause goroutine backlogs, affect the performance of core)
2. Introduce the new way to sweep executions, a global scheduled job will take the work.

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-21 10:10:55 +08:00
Wang Yan bb291aaa16
add middleware for artifact with subject (#18369)
As for the distribution spec 1.1, it supports client to push an manifest with subject field. By leverging this fidle, harbor could build up the linkage between the subject artifact and it's accessories.

Signed-off-by: wang yan <wangyan@vmware.com>
2023-03-19 20:09:41 +08:00
stonezdj(Daojun Zhang) ab636fe3da
Remove go routine to reloadSetting (#18318)
Config is cached in redis
  Fixes #18189

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-03-11 15:45:50 +08:00
Chlins Zhang 90db04e92d
refactor: refact the webhook API and life process (#18255)
refactor: refact the notification job API and life process

1. Introduce new APIs for webhook jobs management.
2. Refact legacy APIs for backforward compatible.
3. Migrate the webhook jobs process to unified execution/task framework.

Closes: #18210

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-03 10:17:47 +08:00
Wang Yan 738fde7d3b
remove chartmuseum backend (#18191)
Harbor deprecates chartmuseum as of v2.8.0

Epic: https://github.com/goharbor/harbor/issues/17958

Discussion: https://github.com/goharbor/harbor/discussions/15057

Signed-off-by: Wang Yan <wangyan@vmware.com>
2023-02-16 18:11:05 +08:00
Wang Yan 277c78e212
update system artifact schedult timeout (#17902)
fixes #17887
enhance the timeout to 5m to avoid system artifact failed to schedule in the helm base installation.

Signed-off-by: Wang Yan <wangyan@vmware.com>

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-12-02 14:30:05 +08:00
Wang Yan 18a3373725
bump beego (#17801)
* bump beego

upgrade beego version from v1.10.12 to v2.0.5

1, beego v2 vserver/web refactor
2, beego v2 context refactor
3, beego v2 session refactor
4, beego v2 cache refactor
5, beego v2 orm refactor

Signed-off-by: MinerYang <yminer@vmware.com>
2022-11-24 18:07:42 +08:00
yanggang 0f4e2daf4c
Replaced io/ioutil with "os / io" package. (#17792)
Signed-off-by: yanggang <gang.yang@daocloud.io>

update typo

Signed-off-by: yminer <yminer@vmware.com>

Signed-off-by: yminer <yminer@vmware.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
2022-11-17 10:02:29 +08:00
Chlins Zhang 9c9aa58d6a
feat: support customize session timeout (#17767)
Add configuration session_timeout for API, then user can customize the
timeout from system config page or API. The timeout is 60 minutes by
default.

Signed-off-by: chlins <chenyuzh@vmware.com>

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-11-15 11:30:01 +08:00
stonezdj(Daojun Zhang) a47e175056
Remove email configuration (#17712)
Email related settings are deprecated
   Remove email ping API
   Fixes #17683

Signed-off-by: stonezdj <stonezdj@gmail.com>

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-11-14 15:03:49 +08:00
Chlins Zhang 1a1a6d2fd2
feat: log completion message when database migrated (#17684)
Signed-off-by: chlins <chenyuzh@vmware.com>
2022-10-31 10:45:05 +08:00
Maksym Trofimenko 486bdb6b99
Fix redirect url redirect_url when OIDC auth mode is enabled (#17628)
* fix redirect url for OIDC auth mode

Signed-off-by: Maksym Trofimenko <maksym@container-registry.com>

* portal lint_fix

Signed-off-by: mtrofimenko <gtpoxa@gmail.com>

* make linter happy

Signed-off-by: mtrofimenko <gtpoxa@gmail.com>

Signed-off-by: Maksym Trofimenko <maksym@container-registry.com>
Signed-off-by: mtrofimenko <gtpoxa@gmail.com>
Co-authored-by: Maksym Trofimenko <maksym@container-registry.com>
2022-10-21 14:38:13 +08:00
Wang Yan ebab99613f
update session log level (#17300)
To avoid too much noise in the core log, udpate the level to debug.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-08-03 13:51:26 +08:00
Adam bf741ad381
feature: Use RegisteredClaims instead of deprecated staruct StandardClaims (#16206)
Signed-off-by: wujw39640 <wujw39640@hundsun.com>
2022-08-01 10:23:47 +08:00
MinerYang f7ebf20d2e
Disable Nydus middleware for v2.6 (#17233)
disable nydus middleware for v2.6

Signed-off-by: yminer <yminer@vmware.com>

remove nyduus module import in main.go

Signed-off-by: yminer <yminer@vmware.com>
2022-07-27 08:41:33 +08:00
Loong Dai 09371b48e8
lint: sort imports (#17131)
* lint: add goimports

Signed-off-by: Loong Dai <loong.dai@intel.com>
2022-07-20 11:33:08 +08:00
MinerYang efd9632e96
add nydus middleware (#17126)
Signed-off-by: yminer <yminer@vmware.com>

remove comments

Signed-off-by: yminer <yminer@vmware.com>

update ut manifest

Signed-off-by: yminer <yminer@vmware.com>

modify comment manifest

Signed-off-by: yminer <yminer@vmware.com>

updtae ut testcase

Signed-off-by: yminer <yminer@vmware.com>

fixwhitespace lint

Signed-off-by: yminer <yminer@vmware.com>

update isNydus judgement && define annotation var

Signed-off-by: yminer <yminer@vmware.com>

whitespace lint

Signed-off-by: yminer <yminer@vmware.com>
2022-07-08 09:56:10 +08:00
Shengwen YU 315d8a8993
fix: update code in compliance with golangci-lint revive (#17087)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-07-01 14:52:47 +08:00
Wang Yan 94bf1c0ebd
Resovle the system artifact schedule issue (#17098)
Scheduling of system artifact depends on the jobservice, where gorountine is used to avoid the circular dependencies between core and jobservice.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-07-01 14:25:45 +08:00
stonezdj(Daojun Zhang) aa63569de2
Fix scan log mismatch issue (#17085)
Add checks in label

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-06-28 18:12:38 +08:00
Wang Yan ea2ed27a7d
add url raw query check middleware (#17070)
The middleware can give a uniform url validation and raised error early.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-06-24 17:57:46 +08:00
Shengwen YU e9fca3de45
fix: refactor code for golangci-lint whitespace (#17005)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-06-16 17:42:46 +08:00
Shengwen YU c2a9f5de64
fix: update code for golangci-lint gosimple (#16974)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-06-14 13:44:09 +08:00
stonezdj(Daojun Zhang) e778ec2edf
Add audit_log forward endpoint (#16914)
add config item to set log forward endpoint
  fallback the audit log to default log when endpoint in error

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-06-10 10:59:40 +08:00
prahaladdarkin 4d062c33d1
Introduce system artifact manager cleanup job (#16879)
Signed-off-by: prahaladdarkin <prahaladd@vmware.com>
2022-06-09 14:16:50 +08:00
Shengwen YU b43ba15f40
fix: golangci-lint errcheck (#16920)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-06-07 17:00:36 +08:00
MinerYang 9d8e9158de
fix deadcode lint & update golangci-lint.yaml (#16896)
* fix deadcode lint & update golangci-lint.yaml

Signed-off-by: yminer <yminer@vmmware.com>

mock.go

Signed-off-by: yminer <yminer@vmmware.com>

commentfmt

Signed-off-by: yminer <yminer@vmmware.com>

mock.go update

Signed-off-by: yminer <yminer@vmmware.com>

update makefile

Signed-off-by: yminer <yminer@vmmware.com>

* update /pkg/allowlist/validator.go

Signed-off-by: yminer <yminer@vmmware.com>

Co-authored-by: yminer <yminer@vmmware.com>
2022-05-26 10:32:07 +08:00
chlins 0fd0c84446 feat(project): introduce cache manager for project (#16740)
Implement cached manager for resource project and migrate project.Mgr
to pkg.ProjectMgr.

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-05-11 15:52:09 +08:00
Wang Yan d3d4ad6a34
fix staticcheck issues (#16828)
Fix the staticcheck problems that reported by golangci-line staticcheck

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-05-10 16:07:10 +08:00
MinerYang 083b44e719
bump up astaxie/beego@v1.12.1 to beego/beego/@v1.12.7 (#16770)
Signed-off-by: yminer <yminer@vmmware.com>

goo mod tidy

Signed-off-by: yminer <yminer@vmmware.com>

Co-authored-by: yminer <yminer@vmmware.com>
2022-04-28 11:58:44 +08:00
stonezdj(Daojun Zhang) 1449988353
Delete unused files and functions (#16599)
testing/apitest/apilib is not used after harbor 2.4 refactor
 no testcase removed

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-03-29 14:19:36 +08:00
chlins dbb8859ad8 feat: implement beego session provider
Signed-off-by: chlins <chenyuzh@vmware.com>
2022-03-24 10:33:21 +08:00
Wang Yan 7531168c92
update log with more inclusive language (#16569)
Use the deactive for instead in the error log

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-03-23 10:56:00 +08:00
stonezdj 478d21687b Improve the migrate process
In order to separate the migrate process from core process, add parameter -mode for main function, it can be normal, migrate, skip_migrate.
Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-02-14 13:15:18 +08:00
stonezdj(Daojun Zhang) 060341ba4e
Merge pull request #15949 from stonezdj/21nov4_cache_properties
Enable db config cache explicitly
2021-11-16 14:39:10 +08:00
stonezdj 21601f5e3c Enable db config cache explicitly
previous config is not cached because it is initialized when cache is not ready

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-11-04 16:01:25 +08:00
Wang Yan a956758302
bump up go version to v1.17 (#15865)
* bump up go version to v1.17

Signed-off-by: Wang Yan <wangyan@vmware.com>

* gofmt fail

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-10-25 17:28:29 +08:00
stonezdj(Daojun Zhang) bc6a7f65a6
Merge pull request #15677 from stonezdj/21sep27_remove_error_log
Change log level to debug
2021-10-21 09:25:18 +08:00
Wang Yan f57c426409
bump up jwt version (#15730)
Upgrade the jwt to github.com/golang-jwt/jwt/v4, and it's backwards compatible with v3.x.y.

Signed-off-by: wang yan <wangyan@vmware.com>
2021-10-08 16:09:00 +08:00
stonezdj 06715af303 Allow empty email attribute for ldap/oidc user
Define user.Email as sql.NullString to avoid unique constraint when email is empty in LDAP/OIDC
  Separate the common/models/User with the pkg/user/dao/User
  Fixes #10400
Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-09-30 14:35:18 +08:00
stonezdj a00a83df38 Fix all issues related to the noise in the logs
Change log level to debug when required
Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-09-29 20:19:53 +08:00
Daniel Jiang 5522ccbd93
Merge pull request #15521 from wy65701436/remove-quota-switch
remove the internal legacy API to switch quota
2021-09-24 18:21:53 +08:00
Qian Deng 31707dbf25 Using harbor lib config
using config manager to get env configs

Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-18 10:58:52 +00:00
Qian Deng bad913cf6d Refactor trace code
* use lib trace helper function
* add gracefull shutdown
* Add commens for new added exposed function
* Add licence on top of new created files
* Update trace library
* Update configs
* Add attribute and namespance in config

Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-18 10:58:52 +00:00
Qian Deng a15983432c Add trace for core
* Add trace related lib
* Add trace middleware for core
* add rid for middleware

Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-18 10:58:52 +00:00
He Weiwei 06f2414d1c
fix: use ctx from http request for middlewares (#15523)
1. Use ctx from http request for the readonly middleware.
2. Refactor the AuthenticateHelper to let it get orm from ctx of the http request.
3. Change to use ctx from http request for oidc and authproxy http handlers.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-09-02 19:05:35 +08:00
stonezdj(Daojun Zhang) 6b8c5c9edd
Add usergroup search API (#15483)
Fixes #15450
  Add paging function to usergroup list/search API
  Fix some 500 error when adding LDAP user/group to project member

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-09-02 09:04:33 +08:00
Wang Yan 581bb8833e remove the internal legacy API to switch quota
The init design of this API is to avoid the quota error leads to system disaster.
As quota has been refineded and redis lock has been removed, the API can be deprecated safely.

And this API is only call the DB to refresh quota data, user can call the SyncQuota API to handle this.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-09-01 10:49:03 +08:00
Wang Yan f7b1610476
replace jwt model (#15367)
update the jwt model to github.com/golang-jwt/jwt
Starting from v3.2.1, the import path has changed from github.com/dgrijalva/jwt-go to github.com/golang-jwt/jwt.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-07-29 11:08:10 +08:00
Daniel Jiang 422894a0f5 Remediate the empty subiss problem
This commit include 2 changes to mitigate and remediate the problem
described in #15241

1. When the token is to be updated in the "oidc_user" table, make sure
   only the column "token" will be udpated.
2. Restore the subiss column for the record that has this column cleared
   by mistake, by decoding the persisted token.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-07-16 00:07:47 +08:00