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
chlins
3d7a5064e9
fix: trim linebreaks for log parameters
...
Signed-off-by: chlins <chenyuzh@vmware.com>
2022-02-16 10:52:58 +08:00
chlins
b37a987073
fix: fix codeql alerts
...
Signed-off-by: chlins <chenyuzh@vmware.com>
2022-02-15 17:25:02 +08:00
Shengwen Yu
d2ae0165c9
feat: add failure-tolerance for gc
...
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-01-10 11:34:10 +08:00
chlins
adf866e629
fix: resolve the codeql alerts
...
Signed-off-by: chlins <chenyuzh@vmware.com>
2021-12-15 13:49:42 +08:00
Wang Yan
6014646bcb
fixes gc dry run issue ( #15804 )
...
fixes #15332 , for the dry run mode, gc job should not remove the untagged candidates.
To fix it, use the simulate untagged artifact deletion for dry-run.
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-10-19 07:42:54 +08:00
yxxhero
63b8e6a9ce
add unittest for jobservice/common/utils package and fix a issue for IsValidURL ( #15539 )
...
add unittest for common utils package and fix a issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-24 19:07:55 +08:00
Qian Deng
354a2bd80d
Enhance the trace related code
...
* Move request id to requestid middleware
* fix span pass to child ctx on orm
* fix typos
* remove unused code
* add operation name to Transaction
Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-22 04:14:43 +00: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
6fec5b2873
Add trace to jobservice
...
* Add trace init in main
* Add env template
* Add trace for router
Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-18 10:58:52 +00:00
Qian Deng
879eecc926
Refactor and Add trace to http Transport
...
* Refactor common http GetTransport function signature
* Remove redendent GetHTTPTransport and similar functions
* Update Authorized function signature to meet new HTTPTransport
* Add trace for default Transport
Signed-off-by: Qian Deng <dengq@vmware.com>
2021-09-18 10:58:52 +00:00
Ziming Zhang
98cef43ead
limit replication bandwidth
...
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-09-14 11:23:28 +08:00
Steven Zou
6b5cd3a7a5
feat(schedule):sync schedules in db to js datastore
...
- add a sync worker to sync db schedules when js starting. add missing ones and clear dirty ones.
- update task model to contain status revision info
- update job lifecycle tracker save() method
- update job ACK model
- add UT cases
- update malformat comments
fix #15323
Signed-off-by: Steven Zou <szou@vmware.com>
2021-09-07 08:33:01 +08:00
Wang Yan
e0c4ebd84d
fix gc delete manifest log issue ( #15495 )
...
It needs to use the logger to print error log when timeout, otherwise, it will be dropped.
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-08-30 13:40:33 +08:00
He Weiwei
d482a0c323
fix: avoid panic in the RetryUntil ( #15501 )
...
1. Use jpillora/backoff to get the backoff to avoid the panic in RetryUntil.
2. Return with last err when retry timeout.
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-08-27 17:28:33 +08:00
Wang Yan
29ccdff766
add retry for blob & manifest deletion in GC ( #15235 )
...
Fixes #15197
To handle the blob & manifest deletion error, add 1 minute retry.
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-07-01 18:49:40 +08:00
Wang Yan
1abe978e87
refactor job log
...
Move job service logger to new program model
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-06-29 13:37:45 +08:00
Wang Yan
8a0cd99473
fixes 13976 ( #15047 )
...
Fixes #13976 for the quota exceed case, gc will print the untagged blobs for dry-run
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-06-04 15:56:53 +08:00
Wang Yan
42a9d0d905
remove common project code ( #14939 )
...
move project model from common to pkg
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-05-25 11:01:19 +08:00
Wang Yan
a08709b50d
deprecate read only GC job ( #14773 )
...
After refactor GC, the way to trigger read only GC job has been deprecated, remove the code.
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-04-29 10:34:13 +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
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
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
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