Commit Graph

406 Commits

Author SHA1 Message Date
MinerYang
e9d2f50669
update mockery to v2.42.2 (#20258)
Signed-off-by: yminer <yminer@vmware.com>
2024-04-11 03:37:59 +00:00
stonezdj(Daojun Zhang)
be648ea47f
Refactor scan job service make it easy to add new scan type (#20177)
Signed-off-by: stonezdj <daojunz@vmware.com>
Signed-off-by: stonezdj(Daojun Zhang) <stonezdj@gmail.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
2024-04-09 16:05:30 +08:00
zycupup
ee6f61c502
feat: volc cr adapter (#19456)
feat: support volcEngine replication

Signed-off-by: zhuyuchen.1 <zhuyuchen.1@bytedance.com>
2024-01-19 14:15:49 +08:00
MinerYang
b38de22054
bump golang 1.21.5 & fix golangci-lint error (#19722)
bump golang 1.21.5

update golangci-lint && fix revive error

fix white space lint

Signed-off-by: yminer <yminer@vmware.com>
2023-12-19 09:41:26 +08:00
Maksym Trofimenko
996e57b511
Feature: GDPR compliant audit logs (#17396) 2023-11-20 21:31:22 +01:00
Daniel Jiang
3f7c605cf5
[WIP] Remove vendor folder from harbor code base (#19508)
* Remove vendor folder from harbor code base

Signed-off-by: Daniel Jiang <jiangd@vmware.com>

* debug ut failure

* debug failure

* debug failure

---------

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2023-11-05 14:37:25 +08:00
Wang Yan
927e7f92a2
fix gc dry run issue (#19208)
In the dry run mode, the accessories should be considered when try to simulate delete the subject manifest.

Signed-off-by: wang yan <wangyan@vmware.com>
2023-08-21 13:28:07 +08:00
Chlins Zhang
c7e25295fe
fix: support customize cache db for business (#19182)
Support to configure the customized redis db for cache layer and other
misc business for core, by default the behavior is same with
previous(stored in db 0).

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-08-18 11:04:16 +08:00
Wang Yan
d93f24a4dc
fix dry run creation time (#19060)
fixes #19059
Give the mock time for dry run, otherwise, it will be zero.

Signed-off-by: wang yan <wangyan@vmware.com>
2023-07-31 17:29:56 +08:00
Wang Yan
638c26c41a
add details for gc dry-run (#19050)
* add details for gc dry-run

fixes 19040
Gives the make details for the dry-run

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

* Update details column for gc history (#164)

1.Fixes #19038

Signed-off-by: AllForNothing <sshijun@vmware.com>

---------

Signed-off-by: wang yan <wangyan@vmware.com>
Signed-off-by: AllForNothing <sshijun@vmware.com>
Co-authored-by: Shijun Sun <30999793+AllForNothing@users.noreply.github.com>
2023-07-31 13:53:51 +08:00
Wang Yan
ae33dbd801
fix accessory import issue (#19053)
fixes #19041

The issuse was introduced by https://github.com/goharbor/harbor/pull/17087.
To move the import to main since the anonymous imports only allowed at main in go-cilint.

Fixes it:
To add the anonymous imports at the jobservice main since the gc job needs to remove accessory when to delete an artifact

Signed-off-by: wang yan <wangyan@vmware.com>
2023-07-30 22:36:03 +08:00
Chlins Zhang
c030fd7863
refactor: replace the gc redigo client to the standard cache (#18965)
Refactor the clean redis logic in the GC job, replace the redigo client
to the lib cache interface which can simplify operations.

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-07-24 14:30:25 +08:00
Wang Yan
7435c8c5ab
add multiple deletion of GC (#18855)
User can specify the workers when to issue an GC execution, the maxium count of workers is 5.

Signed-off-by: wang yan <wangyan@vmware.com>
2023-06-29 16:22:18 +08:00
Bin Liu
1d6c02f52d
jobservice: update readme (#18849)
To reflect the newest job interface, and the missing parts of
DB job service logger.

Signed-off-by: bin liu <liubin0329@gmail.com>
2023-06-27 09:13:47 +08:00
Bin Liu
4035f438fb
jobservice: add DB to job logger config (#18821)
jobservice: add DB to job logger config in readme

Job logger support file, db and stdout, the comment should
include the type of DB as well as file and stdout.

Signed-off-by: bin liu <liubin0329@gmail.com>
2023-06-19 14:19:21 +08:00
Wang Yan
680c78d368
add more details in gc history (#18779)
Show more infors in the gc history, like the sweep size and how many blobs and manifests were removed by GC.

Signed-off-by: Wang Yan <wangyan@vmware.com>
2023-06-02 17:33:09 +08:00
stonezdj(Daojun Zhang)
9d042ad585
Use subtle.ConstantTimeCompare instead of compare directly (#18697)
Signed-off-by: stonezdj <daojunz@vmware.com>
2023-05-22 16:16:52 +08:00
Shengwen YU
845bcdb184
fix: add retry on the caller of v2DeleteManifest instead within v2DeleteManifest (#18662)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
2023-05-18 09:35:33 +08:00
Chlins Zhang
36c2b93fe6
fix: sweep executions of image scan job (#18649)
1. Change the SCAN_ALL job execution retain counts from 5 to 1(per
   current design, only one report be stored for every artifact, so
   retain latest 1 is enough).
2. Enable the sweep for IMAGE_SCAN job(retain latest 1).

Fixes: #18633

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-05-10 13:23:54 +08:00
MoonStrider
bf6389e6c8
fix: error log use wrong variable err (#18602)
Update manager.go

Signed-off-by: MoonStrider <37744291+dyf991645@users.noreply.github.com>
2023-04-26 21:10:41 +08:00
MinerYang
ebac530b46
add goheader linter settings (#18503)
fix files for goheader linter

fix copyright 2018/2019

Signed-off-by: yminer <yminer@vmware.com>
2023-04-25 11:18:42 +08:00
Danny Kulchinsky
14e4c07d94
GC: correctly handle manifest unknown (404) condition in v2DeleteManifest retry loop (#18386)
GC: handle manifest unknown (404) during V2 manifest delete retry loop

Signed-off-by: Danny Kulchinsky <dkulchinsky@fastly.com>
2023-04-12 22:52:52 +02:00
Chlins Zhang
5791f0c979
fix: fix error bitsize of jobservice reaper scan locks (#18487)
Change the bitSize from 16 to 64 in the jobservice reaper, the 16 is too
small when the redis cursor over the max value of int16.

Fixes: #18486

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-04-07 10:59:30 +08:00
Chlins Zhang
6e9f72315f
fix: fix the invalid jobid for scan data export (#18398)
Change the JobId param type from int to string, use int will bring some
problems for encode/decode type mismatch which generate the invalid
repository name.

Fixes: #18380

Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-29 10:29:08 +08:00
Chlins Zhang
395ae77d64
fix: change the default max retry count for webhook job to 3 (#18392)
Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-22 17:36:50 +08:00
Chlins Zhang
6590fe8eef
fix: register sweeper retain counts for purge audit log job (#18390)
Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-22 15:22:24 +08:00
stonezdj(Daojun Zhang)
46fa91f866
Fix dangling state execution (#18272)
Add max update hour and max dangling hour setting in config.yaml
  Fixes #17611

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-03-21 18:48:14 +08:00
Chlins Zhang
67d3f9add8
feat: support configurate the http client timeout for webhook job (#18382)
Signed-off-by: chlins <chenyuzh@vmware.com>
2023-03-21 11:54:10 +08:00
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