Commit Graph

378 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
Chlins Zhang 65e675d2e6
feat: integrate CloudEvents to webhook (#18322)
Integrate CloudEvents as payload format for webhook.

Closes: #17748

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-14 10:44:25 +08:00
Shengwen YU 4efee54f07
feat: upgrade mockery version (#18332)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2023-03-11 08:16:11 +08:00
stonezdj(Daojun Zhang) 5c0266e719
Get job log by job_id in worker (#18261)
Get job by job_id in redis

  Get the last 10MB of data if it exceeds 10MB

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-03-06 13:19:10 +08:00
stonezdj(Daojun Zhang) 58054c0ce8
Change queue name for purge audit log and filter the old one (#18182)
Fixes #18121
 Refactor job name with VendorType prefix, make sure job queue name and vendor type in execution and task are identical

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-02-20 16:03:22 +08:00
Chlins Zhang da1637e1d3
fix: resolve the oidc or ldap group user cannot export cve (#18219)
Remove the project filter in the scan data export job as they have been
validated by API handler, fix the oidc or ldap group users cannot export
cve.

Fixes: #18112

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-02-20 14:22:27 +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
Noah Tang a9a67462dc
add job status unit test (#18057)
Signed-off-by: coderth <coderth@outlook.com>

Signed-off-by: coderth <coderth@outlook.com>
2023-01-10 13:28:28 +08:00
Aleksandr Chebotov 452ae168cc
fix purge info typo (#18023)
Signed-off-by: Aleksandr Chebotov <alk.chebotov@gmail.com>
2023-01-03 13:48:14 +08:00
Christian Zenker 9674a51b83
fix: Don't supress redis error messages to make debugging easier (#17986)
Signed-off-by: Christian Zenker <christian.zenker@aoe.com>

Signed-off-by: Christian Zenker <christian.zenker@aoe.com>
2022-12-15 10:42:16 +08:00
Wang Yan d83cee083a
remove artifact_blob with aritfact deletion (#17913)
fixes #17857

It needs to clean the artifact_blob records on artifact deletion in GC

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

Signed-off-by: Wang Yan <wangyan@vmware.com>
2022-12-07 13:37:10 +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
Chlins Zhang 321a9abfb3
fix: skip to push system artifact for empty CSV file (#17816)
1. Skip to push system artifact to the distribution when the exported CSV file is empty.
2. Add status message for cve export execution.

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-11-18 14:16:36 +08:00
MinerYang 62223bd36d
update golangci-lint for golang1.19 (#17817)
update golaci-lint for golang1.19

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

update ci version to v1.50.1
2022-11-18 11:40:01 +08:00
stonezdj(Daojun Zhang) 57aff88eb5
Add REST API to list job queue status, pause/resume job queue and list schedulers (#17707)
Add queue manager and redis client
  Update scheduler to add count and list

Signed-off-by: stonezdj <daojunz@vmware.com>

Signed-off-by: stonezdj <daojunz@vmware.com>
2022-11-17 20:12:07 +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
stonezdj(Daojun Zhang) 39ca918ffe
Add jobservice monitoring api list pool, worker and stop running task (#17658)
Add REST API to list job pool, worker, stop running task

  Add jobservice handler to retrieve configuration
  Add RBAC for jobservice monitoring dashboard
  Add REST API to list pool, worker and stop running task

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

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-11-03 10:47:40 +08:00
Chlins Zhang bf4cfe9e1e
fix: add human friendly message when export cve job failure (#17726)
Add human friendly when export CVE in the condition of empty CSV file,
because this file will be stored as system artifact and pushed to
distribution, but it will leads to error when push empty blob to S3
storage driver.

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-11-01 15:04:07 +08:00
Chlins Zhang c330b8c63a
feat: introduce the copy by chunk for replication (#17602)
1. Add sql migration to alter replication policy table
2. Implement the PullBlobChunk and PushBlobChunk for the underlying v2 registry client
3. Update image transfer logic to support copy by chunk
4. Update the replication policy API handler

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-11-01 11:19:17 +08:00
Eng Zer Jun cd0fa06a32
test: use `T.Setenv` to set env vars in tests (#17670)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-25 10:56:26 +08:00
Gaius 25a42af277
test: add GetRedisURL to tests redis pkg and fix hardcoded redis url (#17581)
Signed-off-by: Gaius <gaius.qi@gmail.com>
2022-10-17 17:21:37 +08:00
Chenyu Zhang 5d7a549620
upgrade: bump up mockery to v2.14.0 (#17415)
Signed-off-by: chlins <chenyuzh@vmware.com>
2022-08-22 14:21:13 +08:00
Chenyu Zhang 1e13999fff
fix: validate export cve request params (#17341)
1. Validate export cve request params in the API handler
2. Trim space for request in the scan export job

Closes: #17326

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-08-08 11:07:05 +08:00
Chenyu Zhang 49d73fa57d
fix: export cve for image manifest list (#17333)
1. Fix export cve for image manifest list
2. Remove row_id column in csv file
3. Update cve execution swagger API description

Closes: #17331,#17330,#17335,#17334

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-08-05 20:07:02 +08:00
prahaladdarkin c776ea8bfe
Export CVE data Score column empty values (#17321)
Closes: https://github.com/goharbor/harbor/issues/17189

Signed-off-by: prahaladdarkin <prahaladd@vmware.com>
2022-08-05 10:03:42 +08:00
Chenyu Zhang 19e73174e2
refactor: refact codebase of cve export process and filter (#17254)
1. Refact the scan export FilterProcessor interface
2. Optmize the sql template for export cve report
3. Update the process of cve export job

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-07-28 16:05:12 +08:00
prahaladdarkin d53af792ad
Fixes for various bugs/issues logged as a part of the test day. (#17232)
Closes:
* CVE Data Export API IDOR issue
* https://github.com/goharbor/harbor/issues/17199
* https://github.com/goharbor/harbor/issues/17193
* https://github.com/goharbor/harbor/issues/17188
* https://github.com/goharbor/harbor/issues/17184

Signed-off-by: prahaladdarkin <prahaladd@vmware.com>
2022-07-26 16:50:54 +08:00
stonezdj(Daojun Zhang) 712419778a
Return bad request if audit log retention hour > 240000 hour (#17217)
Cap the retention hour to 240000 hour
  Fixes #17198

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-07-22 15:14:10 +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
stonezdj(Daojun Zhang) 9a41272986
Change the log to logger in purge job (#17162)
Fixes #17151

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-07-14 17:46:52 +08:00
prahaladdarkin 130452111b
Vulnerability scan data export functionality (#15998)
Vulnerability Scan Data (CVE) Export Functionality
Proposal - goharbor/community#174
Closes - https://github.com/goharbor/harbor/issues/17150
Changes:
* CVE Data export to CSV with filtering support.
* Implement CSV data export job for creating CSVs
* APIs to trigger CSV export job executions

Signed-off-by: prahaladdarkin <prahaladd@vmware.com>
2022-07-11 16:35:04 +08:00
Chenyu Zhang 1a1ce634cc
Fix the process of cache layer (#17010)
fix: fix cache layer issues (#16995,#16997,#16996,#17038)

1. Load config and initialize cache layer in jobservice(for GC)
2. Cache artifact by digest the key should contains repository name
3. Repository cache cleanup error when update
4. Skip save cache when request ctx in transaction

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-07-06 16:11:53 +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
Wenkai Yin(尹文开) ab74e853ee
Enhance the read-only API to avoid deleting operations during the job running (#17055)
Enhance the read-only API to avoid deleting operations during the job running

Fixes #16901

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-06-29 08:00:17 +08:00
stonezdj(Daojun Zhang) c639257ba7
Support stop purge audit log job (#17033)
fixes #17006

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-06-28 11:15:11 +08:00
MinerYang aab320591f
golangci-lint fix ineffassign (#17027)
Signed-off-by: yminer <yminer@vmware.com>

delete src/lib/redis/helper.go

Signed-off-by: yminer <yminer@vmware.com>
2022-06-21 12:01:59 +08:00
Chenyu Zhang c7e153654a
fix: update the jobservice hook retry concurrency (#17024)
Change the jobservice hook max retry concurrency from 512 to same with
the js worker numbers.

Signed-off-by: chlins <chenyuzh@vmware.com>
2022-06-18 13:52:33 +08:00
Wenkai Yin(尹文开) 6c515b04d4
Support stop GC execution (#17004)
Support stop GC execution

Fixes 16902

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-06-17 20:03:24 +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
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 9b22e2943f
bumpup mockery to v1.12.3 (#16955)
Signed-off-by: yminer <yminer@vmmware.com>

Co-authored-by: yminer <yminer@vmmware.com>
2022-06-07 16:04:33 +08:00
stonezdj(Daojun Zhang) 0dc7a6806c
Add NextScheduledTime in schedule object (#16925)
Add NextSchedule in utils
  Add NextScheduledTime in ScheduleObj to display it in UI

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-06-06 22:17:41 +08:00
stonezdj 1839965c7a Add REST API for purge audit log
Add rest API for purge audit log
  Extract scheduler, execution, task from GC controller for common use

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-05-23 16:58:31 +08:00
stonezdj 3ac7281177 Add job service to purge audit_log
Add jobservice type PurgeAuditLog

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-05-16 21:52:58 +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
Shengwen Yu d0c82db519 fix: improve GC log message
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-05-06 15:01:45 +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 5618f6d211 The DB config manager is not init on jobservice to call config.WithNotary
Make func defaultMgr() public
  Set DefaultCfgManager to RestCfgManager and Load it in the jobservice main
  config.WithNotary call DefaultMgr(), it wil get the RestCfgManager
  Fixes #16418

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-03-03 14:42:56 +08:00