Commit Graph

4932 Commits

Author SHA1 Message Date
Daniel Jiang
6668883c36 Do not get OIDC info for admin user
This commit skips getting OIDC meta info for admin user.
It fixes the issue that admin user cannot login to portal, which was
introduced in refactor.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-04-14 21:51:53 +08:00
Daniel Jiang
d1426fb0c5
Merge pull request #14635 from stonezdj/21apr13_move_config_exp
Move common config api to lib/config
2021-04-14 18:08:18 +08:00
stonezdj(Daojun Zhang)
dd7bd72122
Merge pull request #14645 from stonezdj/21apr14_fix_projmember_fresh_user
Fix nightly issue: can not add user that never logged in projectmember api
2021-04-14 16:42:10 +08:00
Archer1A
264e2e45f2
fix(jobservice): value out of range (#14634)
value out of range when job count bigger than 256

Signed-off-by: vic <985695123@qq.com>
2021-04-14 14:28:36 +08:00
stonezdj
1f5b3b11f4 Fix nightly issue: can not add user that never logged in
Handle the NotFoundError in userManager.GetUserByName()

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-14 13:32:47 +08:00
stonezdj
ef73c45681 review comments
Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-14 12:26:27 +08:00
Wenkai Yin(尹文开)
28d4e285f9
Fix bug of ping registry (#14625)
Fix bug of ping registry
fixes #14610

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-04-14 11:11:09 +08:00
stonezdj
9807a5a9ff Merge branch 'master' into 21apr13_move_config_exp
# Conflicts:
#	src/common/dao/project/projectmember_test.go
#	src/core/api/projectmember.go
#	src/core/auth/ldap/ldap_test.go
#	src/server/v2.0/handler/project.go
2021-04-14 09:45:48 +08:00
stonezdj
751d404519 Refactor project member api to new programming model
Add pkg/member/dao
    Add pkg/member/models
    Add pkg/member/manager
    Add controller/member
    Remove the old project member API

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-13 21:28:54 +08:00
stonezdj
60478f4990 Move common config api to lib/config
Register all config managers, and get it by getConfigManger()

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-13 19:43:33 +08:00
Will Sun
81f0e0685a
Fix creating replication rule issue and creating proxy cache project issue (#14614)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-13 16:28:02 +08:00
Daniel Jiang
1d01db3d3c
Merge pull request #14604 from reasonerjt/users-api-refact-2
API for users to new model
2021-04-13 16:21:51 +08:00
Steven Zou
39256193ca fix(js):job log not found issue
- return 404 code when the job log is not found

Signed-off-by: Steven Zou <szou@vmware.com>
2021-04-13 12:11:31 +08:00
Daniel Jiang
d4cd2b87bd API for users to new model
This commit moves the legacy apis related to users to new model.
Some funcs under common/dao are left b/c they are used by other module,
which should also be shifted to leverage managers.
We'll handle them separately.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-04-13 11:11:50 +08:00
Ziming Zhang
c775e989df refactor retention dao
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-04-12 16:36:00 +08:00
Wenkai Yin(尹文开)
e4678dc7db
Merge pull request #14578 from ywk253100/210318_replication
Improve the performance of replication
2021-04-12 10:44:32 +08:00
Wenkai Yin
09c3d042ea Improve the performance of replication
Improve the performance of replication by introducing a new API to check whether the blob can be mounted directly

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-04-12 09:54:25 +08:00
Steven Zou
3646b263da
Merge pull request #14591 from steven-zou/fix/hook_resent_issue
fix(js): webhook infinitely resending issue
2021-04-09 17:08:08 +08:00
stonezdj
ac5e908597 Refactor user group to new programming model
Add context to required methods
Add pkg/usergroup/dao
Add pkg/usergroup/manager
Add controller/usergroup/controller

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-09 14:40:48 +08:00
stonezdj
107e468b60 Refactor configure api to new programming model
Changes include:
1. Move core/config to controller/config
2. Change the job_service and gcreadonly to depends on lib/config instead of core/config
3. Move the config related dao, manager and driver to pkg/config
4. Adjust the invocation of the config API, most of then should provide a context parameter, when accessing system config, you can call it with background context, when accessing user config, the context should provide orm.Context

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-09 08:10:11 +08:00
Steven Zou
bb7f706d78 fix(js): webhook infinitely resending issue
- update the resending logic in the hook agent
- use backoff lib to generate backoff duration
- remove retry cache queue
- leverage reaper to restore the sending if direct retries are all failed
- remove useless funcs/codes

fix #14545

Signed-off-by: Steven Zou <szou@vmware.com>
2021-04-08 19:59:16 +08:00
Will Sun
d9052c8241
Fix pull command issue for unlogged users (#14584)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-08 18:42:46 +08:00
Will Sun
778ce4d336
Fix storage display and add build timestamp (#14592)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-08 18:42:29 +08:00
stonezdj(Daojun Zhang)
8d6f4ddc38
Merge pull request #14583 from reasonerjt/authproxy-admin-username
Add attribute admin username for authproxy
2021-04-08 16:56:47 +08:00
Qian Deng
c5d12ce8ee
Merge pull request #14542 from ninjadq/add_task_info_in_exporter
Add task info in exporter
2021-04-07 18:17:26 +08:00
Daniel Jiang
ad8eee8623 Add attribute admin username for authproxy
This commit adds the attribute "http_authproxy_admin_usernames", which
is string that contains usernames separated by comma, when a user logs
in and the username in the tokenreview status matches the setting of
this attribute, the user will have administrator permission.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-04-07 18:14:59 +08:00
DQ
fd62932a1f Enhance: Refactor metrics exporter
* refactor register logic
* remove unused code
* edit some wording

Signed-off-by: DQ <dengq@vmware.com>
2021-04-07 14:57:30 +08:00
Will Sun
85c08d62a4
Add server driven pagination to registries page (#14581)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-07 14:35:53 +08:00
Will Sun
66e0246f81
Support proxy cache for docker-registry type (#14582)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-07 14:35:13 +08:00
Will Sun
19a9561ffa
Improve grid view for repos page (#14500)
Signed-off-by: AllForNothing <sshijun@vmware.com>

Co-authored-by: 孙世军 <sunshijun@sunshijundeMacBook-Air.local>
2021-04-07 14:34:29 +08:00
Will Sun
acba15210b
Add ruote resue strategy (#14524)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-06 16:58:00 +08:00
DQ
dcb28d8e30 Add test case for exporter
add e2e test to verify exporter and jobservice metrics exist

Signed-off-by: DQ <dengq@vmware.com>
2021-04-06 15:54:33 +08:00
Will Sun
f74759667c
Improve replication page (#14566)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-02 14:13:34 +08:00
Will Sun
8b917c0ad3
Fix css issue for task list page (#14560)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-02 12:37:58 +08:00
Will Sun
3604ebc536
Update customizing UI style function (#14550)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-04-01 17:12:17 +08:00
Wenkai Yin(尹文开)
28596c3ffb
Refactor registry API (#14528)
* Refactor registry API

Refactor registry API

Signed-off-by: Wenkai Yin <yinw@vmware.com>

* Fix bugs of replications

1. Fix the scheduled replication doesn't work issue
2. Fix the destination name lost issue when updating replication policy

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-03-31 15:49:23 +08:00
stonezdj(Daojun Zhang)
70165be3f0
Remove the testing/apitests code from this repo (#14518)
Moved to the vmware/harbor-boshrelease repo already

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-03-30 19:07:36 +08:00
DQ
7eebbeebdf Add jobservice task queue related task
add jobservice metrics
add redis client

Signed-off-by: DQ <dengq@vmware.com>
2021-03-30 10:29:36 +00:00
DQ
fbe9cd88f8 Enabled Prometheus for Jobservice
* Add prom server on jobservice
* Enabeld configs in templates
* Enabeld jobservice metrics in nginx

Signed-off-by: DQ <dengq@vmware.com>
2021-03-30 08:52:59 +00:00
stonezdj
5bc1dc8e77 Replace some x-go-type in swagger
Related models:
    LdapFailedImportUser
    LdapUser
    UserGroup

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-03-26 14:03:02 +08:00
Vadim Bauer
e714a8eacc Before fetching the repository check if the project has container
registry enabled.
closes #14328 #13353

Signed-off-by: Vadim Bauer <vb@container-registry.com>
2021-03-24 10:58:19 +08:00
Will Sun
b74c4b0cfe
Add switch button to password input (#14484)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-24 09:25:52 +08:00
Wang Yan
9ef50ed430
refactor notification (#14406)
* Refactor webhook

refactor notification to new programming model

Signed-off-by: wang yan <wangyan@vmware.com>
2021-03-22 17:27:23 +08:00
Wenkai Yin(尹文开)
b2f0a1f0f5
Merge pull request #14400 from ywk253100/210226_registry
Refeactor replication policy APIs
2021-03-22 15:02:46 +08:00
He Weiwei
a2b08446d7
refactor: generate search API by go-swagger (#14422)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-03-22 14:35:44 +08:00
Wenkai Yin(尹文开)
634be34236
Merge pull request #14457 from ywk253100/210316_cpu
[cherry-pick]Fix the consume too much CPU issue
2021-03-17 14:37:29 +08:00
Will Sun
f0b241c695
Add pagination to replication rules searching (#14464)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-17 14:32:45 +08:00
Wenkai Yin
8b1817be0f Fix the consume too much CPU issue
1. Update execution status during the upgrade
2. Refine the execution sweeper

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-03-17 13:34:24 +08:00
Wenkai Yin
3d7fd070c7 Refeactor replication policy APIs
Refeactor replication policy APIs

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-03-17 10:57:31 +08:00
Wang Yan
ad47007438 fix catalog duplicate result
Add distinct to the sql to avoid duplicate records be returned

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-03-16 12:37:33 +08:00
Daniel Jiang
5ab879a670
Merge pull request #14447 from ywk253100/210315_retention_exec
Add upgrade sql file introduced in 2.1.4
2021-03-16 11:14:45 +08:00
Wenkai Yin
43df3bf8a4 Add upgrade sql file introduced in 2.1.4
1. Add upgrade sql file introduced in 2.1.4
2. Minor improvement for task/execution to cover corner cases

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-03-15 16:48:51 +08:00
Will Sun
f03ca3b087
Modify usage of LDAP ping API on UI (#14440)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-15 15:56:54 +08:00
Will Sun
fb3b1311d8
Support adding label to multiple artifacts (#14443)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-15 15:56:34 +08:00
Will Sun
68d7c91596
Add server driven sorting (#14426)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-15 10:07:31 +08:00
He Weiwei
85f9a49bc8
feat: add sorts support for the projects listing API (#14425)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-03-12 15:04:08 +08:00
Daniel Jiang
0d4992a41e
API for system CVE allowlist to new model (#14412)
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-03-12 10:23:48 +08:00
Wenkai Yin(尹文开)
4ef93565f3
Merge pull request #14369 from ywk253100/210303_sort
Introduce "sort" in query to provide a general solution for sorting
2021-03-11 09:28:34 +08:00
Wenkai Yin
506d1ad465 Introduce "sort" in query to provide a general solution for sorting
Introduce "sort" in query to provide a general solution for sorting

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-03-11 08:25:49 +08:00
stonezdj
5a35b7a9c4 Move ldap API to new program model
Fix some issue with the LDAP connection test

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-03-10 16:26:45 +08:00
Wang Yan
85254ccc22
refactor immutable rule (#14371)
Migrate immutable realted APIs to v2 swagger

Signed-off-by: wang yan <wangyan@vmware.com>
2021-03-08 17:10:12 +08:00
Will Sun
f0dd9e5aeb
Fix label color issue (#14387)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-08 16:10:19 +08:00
Daniel Jiang
4c47b1777e
Merge pull request #14370 from reasonerjt/oidc-ping-refact
Switch API to ping OIDC endpoint to new model
2021-03-05 11:49:30 +08:00
chlins
12f3609e42 fix: add precheck when registry check token expired
Signed-off-by: chlins <chlins.zhang@gmail.com>
2021-03-04 18:23:04 +08:00
Wenkai Yin(尹文开)
4c2e698af8
Merge pull request #14341 from heww/refactor-scanner-apis
refactor: generate scanner APIs by go-swagger
2021-03-04 17:48:04 +08:00
Daniel Jiang
e96c1cbced Switch API to ping OIDC endpoint to new model
This commit updates the API POST /api/v2.0/system/oidc/ping to new
programming model, in which the code will be generated by go-swagger.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-03-04 15:44:11 +08:00
Will Sun
afd29280ab
Improve stop button for replication (#14346)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-04 12:04:52 +08:00
Will Sun
5cae2d5d9a
Improve double star validator on UI (#14345)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-04 11:57:43 +08:00
He Weiwei
ef0bdf6954 refactor: generate scanner APIs by go-swagger
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-03-03 04:23:36 +00:00
Daniel Jiang
ef72c76e0e Add "*" to the claim set in the token for /v2 apis
The "*" is used by notary server for permission checking:
84287fd8df/server/server.go (L200)
Hence, we need to add this into the JWT token such that actions like key
rotation can be executed.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-03-02 19:36:04 +08:00
Will Sun
3ecd60b84b
Add harbor datetime pipe (#14331)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-03-01 15:45:21 +08:00
He Weiwei
9161a3fbdf
refactor: use ormer from the ctx for scanner ctl mgr and dao (#14313)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-03-01 12:02:40 +08:00
Wang Yan
5c2d43ea38 add sorting for list blobs
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-02-26 11:52:56 +08:00
Wenkai Yin(尹文开)
fba6dd799e
Merge pull request #14300 from heww/quota-apis
refactor: generate quota APIs by go-swagger
2021-02-26 10:49:52 +08:00
He Weiwei
4b033c266a refactor: generate quota APIs by go-swagger
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-25 08:19:55 +00:00
Will Sun
1955b57701
Remove forced ng-check for registries component (#14302)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-02-25 15:35:30 +08:00
Daniel Jiang
a4a995327b
Merge pull request #14129 from piotrekfilip/Add-support-for-http-proxy-in-oidc-insecureTransport
Add support for http proxy in oidc insecureTransport
2021-02-24 18:51:30 +08:00
He Weiwei
7cfd372af2
fix: use clone query in loop of artifact.Iterator func (#14283)
Closes #14251

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-23 12:23:36 +08:00
Will Sun
617ebb4045
Fix redirection issue for registries (#14270)
Signed-off-by: sshijun <sshijun@vmware.com>
2021-02-22 10:59:42 +08:00
Josh Soref
dfe360040b Spelling
* addition
* attribute
* auditing
* availability
* available
* bandwidth
* browser
* business
* cadence
* chartmuseum
* client
* column
* content
* demonstrate
* described
* endpoints
* facilitate
* github
* harbor
* information
* instance
* manual
* meaningful
* operation
* overridden
* password
* possible
* project
* refactor
* replication
* requires
* running
* scanned
* settings
* signup
* those
* unsigned
* vulnerability

--
Also removes trailing space from a filename

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-19 11:59:15 +08:00
Will Sun
74b6bfe731
Modify cron regex for UI (#14254)
Signed-off-by: sshijun <sshijun@vmware.com>
2021-02-18 15:09:10 +08:00
Will Sun
2d84b62fe2
Refactor UI routing and remove redundant code (#14166)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-02-18 09:12:23 +08:00
Daniel Jiang
51c8375425
Merge pull request #14220 from wy65701436/fix-codeql-quota
fix quota dao sql injection
2021-02-10 10:34:54 +08:00
Wang Yan
496a178eb3 fix quota dao sql injection
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-02-10 03:55:59 +08:00
Wenkai Yin
fe0216ce94 Fix sql issue for querying tasks
Fix sql issue for querying tasks

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-02-09 22:15:06 +08:00
Wang Yan
21d35f9702
update blob list query (#14195)
* update blob list query

Deprecate blob list parameters, and use the query for instead.

Signed-off-by: wang yan <wangyan@vmware.com>

* update per review comments

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-02-09 17:08:26 +08:00
Daniel Jiang
7231679373
Use the Email address from DB instead of request (#14212)
This commit updates the controller for sending reset pwd Email,
to make it use the Email from DB query result.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-02-09 17:04:15 +08:00
He Weiwei
a0561da5ce
test: fix the TestRetryUntil (#14210)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-09 13:25:22 +08:00
Daniel Jiang
0b2ef922c0
Escape the service and email passed via request (#14186)
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-02-08 14:34:52 +08:00
Steven Zou
8725fa3af5
Merge pull request #14198 from steven-zou/fix/issue_#14079
fix(jobservice):wrong depth of job logging
2021-02-08 11:38:46 +08:00
Steven Zou
d61e560890 fix(jobservice):wrong depth of job logging
- use separate std logger for job, not shared with jobservice std logger
- merge and remove useless functions

Signed-off-by: Steven Zou <szou@vmware.com>

fix #14079
2021-02-07 18:07:02 +08:00
piotrekfilip
db47cf7f46
Add support for http proxy in oidc insecureTransport
Signed-off-by: piotrekfilip <43957913+piotrekfilip@users.noreply.github.com>
2021-02-06 12:42:38 +01:00
Wenkai Yin
cc3e240d56 Recover the panic of the process of replication adapter and fix bug of gitlab adapter
Recover the panic of the process of replication adapter
Fix bug of gitlab adapter
Fixes #14153

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-02-05 20:21:10 +08:00
Ziming Zhang
ec83f49a1a fix(retention) migrate sql error
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-02-05 09:09:26 +00:00
He Weiwei
44ba7de738
fix: wrap report vuls record creating in transaction (#14176)
Make the creating of the ReportVulnerabilityRecord in transaction to
avoid parallel problem

Closes #14171

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-05 12:15:52 +08:00
He Weiwei
de97b900cf
fix: remove default execution sweeper count (#14168)
1. Remove the default execution sweeper count for execution vendor.
2. Set the execution sweeper count for gc, preheat, replication,
retention to 50.
3. Disable sweep for the executions of the scan job.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-05 12:15:15 +08:00
Wenkai Yin(尹文开)
99bc251a13
Merge pull request #14164 from heww/update-report-improve
fix: 404 if report not found when updating report
2021-02-04 16:30:18 +08:00
Wang Yan
885a268268
rename permission of robot account (#14150)
* rename permission of robot account

fixes #14060
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-02-04 15:32:44 +08:00
He Weiwei
060a282e71 fix: 404 if report not found when updating report
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-02-04 07:10:58 +00:00
Wenkai Yin(尹文开)
c45adabf5d
Merge pull request #14155 from ywk253100/210203_sweeper
Ignore the not found error in some cases
2021-02-04 14:02:46 +08:00