Commit Graph

753 Commits

Author SHA1 Message Date
Wang Yan
b9228096dc
enable robot to support create project (#15461)
1, for admin only, the system level robot should contains the project creation access.
2, for not admin only, the system level robot can create project.
3, for the project that created by system level robot, use the admin ID as the ownerID.

No path for project level robot to create project.

Signed-off-by: wang yan <wangyan@vmware.com>
2021-08-24 09:34:02 +08:00
yunkunrao
246d863c59 Refactor ping method into util pkg
Signed-off-by: yunkunrao <yunkunrao@gmail.com>
2021-08-19 21:57:25 +08:00
Steven Zou
f3a875abd7
Merge pull request #15344 from bitsf/replication_policy_exclude
feat(replication) add exclude decoration in policy
2021-08-19 14:26:17 +08:00
Daniel Jiang
cdb13f5191
Merge pull request #15291 from kschu91/bugfix/15290
if username is not available in remote, fall back to username from token
2021-08-17 16:58:46 +08:00
Wang Yan
14f7274989
support robot to list project (#15431)
1, add permission check for API of List Projects
2, add permission check for API of List Repositories
3, use the self defined query to handle both names and public query

Signed-off-by: wang yan <wangyan@vmware.com>
2021-08-17 16:35:36 +08:00
Ziming Zhang
62808bf014 feat(replication) refactor replication filter Validate()
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-08-17 14:19:14 +08:00
Ziming Zhang
698c336421 feat(replication) add exclude decoration in policy
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-08-17 14:19:13 +08:00
stonezdj
409039b502 Support IPv6 when connecting to LDAP server
Use net.SplitHostPort instead of strings.Split
 Fixes #15354

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-08-04 12:54:44 +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
Shengwen Yu
766e953325 fix: update adapter ut (mock http requests)
Closes: #15318

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2021-07-22 19:45:36 +08:00
Daniel Jiang
e46e9631fa
Merge pull request #15303 from reasonerjt/fix-15241
Remediate the empty subiss problem
2021-07-16 13:34:40 +08:00
Daniel Jiang
3e983b1747
Merge pull request #15242 from kschu91/bugfix/15241
Fix refreshing oidc access token breaks users subiss in database
2021-07-16 10:58:31 +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
stonezdj(Daojun Zhang)
2fa530eefa
Merge pull request #15247 from stonezdj/21jun30_remove_auth_user
Delete users under auth_mode other than db_auth
2021-07-14 13:25:43 +08:00
stonezdj
c163bc8317 Delete users under auth_mode other than db_auth
The following information should cleanup before delete user:
  Delete project member of this user.
  Delete oidc_user when auth_mode is oidc_auth.
  Fixes #8424
  It also removes the deleted user from project member and the deleted condition in the project member query for consistency
Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-07-12 11:31:40 +08:00
Alexis L
2ce814329b
Merge branch 'goharbor:master' into fix-basedn-empty 2021-07-09 22:32:35 +02:00
Alexis
d6283ee913
Add SearchDN error, mark field as required in UI
Signed-off-by: Alexis <60alexis@gmail.com>
2021-07-09 22:30:52 +02:00
Kevin Schu
03b7b01f77 reverted unintentional committed change
Signed-off-by: Kevin Schu <kevin.schu@aoe.com>
2021-07-08 15:43:14 +02:00
Kevin Schu
0679f4701e if username is not available in remote, fall back to username from token
Signed-off-by: Kevin Schu <kevin.schu@aoe.com>
2021-07-08 15:36:18 +02:00
elihe
426f7bc7bc Fix commentline typos in src/pkg/repository/model/model.go
Signed-off-by: elihe <elihe@tencent.com>
2021-07-02 10:12:15 +08:00
Kevin Schu
4147fbeba0 subiss needs to be part of selected fields, otherwise this attribute would be empty and will cause issues when working with the user object later on.
Signed-off-by: Kevin Schu <kevin.schu@aoe.com>
2021-07-01 15:12:28 +02: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
Jiaolin Yang
a2992327be
Merge pull request #14919 from yunkunrao/master
Fix dragonfly preheat error.
2021-06-03 13:36:15 +08:00
yunkunrao
af814a2af2 Code clean
Signed-off-by: yunkunrao <yunkunrao@gmail.com>
2021-06-01 23:13:03 +08:00
Wenkai Yin(尹文开)
6e649ac39f
Merge pull request #15014 from heww/move-scan-report-to-job
refactor: convert scan report in scan job
2021-05-31 15:55:31 +08:00
Wenkai Yin(尹文开)
f0e1ba4e1b
Merge pull request #15005 from ywk253100/210528_ns
Declare the capability of supported repository path component for registries
2021-05-31 15:53:40 +08:00
He Weiwei
f6a1c31f9f refactor: convert scan report in scan job
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-05-29 12:19:36 +00:00
He Weiwei
c7a4af3170
test: mock the API requests for the huawei registry (#15009)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-05-28 17:09:48 +08:00
Wenkai Yin
741793a553 Declare the capability of supported repository path component for registries
Declare the capability of supported repository path component for registries

fixes #14981
fixes #14980

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-28 10:42:16 +08:00
Ziming Zhang
77b44a62e7 fix aws adapter url
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-05-27 23:29:12 +08:00
yunkunrao
82fd606f8f Update Unit Test.
Signed-off-by: yunkunrao <yunkunrao@gmail.com>
2021-05-27 18:50:47 +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
fanjiankong
306e519dbe Fix tencentcr adapter.
1. Limit API qps for the adapter.
2. Allow set qps via env.
3. Fix Tencnet SDK pagenation.
4. Fix resource filter.

Signed-off-by: fanjiankong <fanjiankong@tencent.com>
2021-05-24 10:33:49 +08:00
He Weiwei
a1ac9b98df
fix: delete robots by project id using raw sql (#14951)
QuerySeter.Delete will call two queies in the orm of beego. First it
will query all primary keys of the model by the QuerySeter, and then the
orm will delete the models using the IN statement of these primary keys.
This will be failed in the postgres when the records more than 65535.
This commit changes to use the raw query to delete the robots of the
project.

Closes #14678

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-05-24 10:31:48 +08:00
yunkunrao
fa8a0d09d6 Fix dragonfly preheat error.
Signed-off-by: yunkunrao <yunkunrao@gmail.com>
2021-05-23 17:50:54 +08:00
Daniel Jiang
dee6064e60
Merge pull request #14926 from reasonerjt/rm-common-dao-oidc-user-onboard
Remove the onboard and update funcs for OIDC user from common/dao
2021-05-20 19:34:59 +08:00
Daniel Jiang
66766a8f69 Remove the onboard and update funcs for OIDC user from common/dao
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-05-20 16:23:07 +08:00
ChenYu Zhang
a50f782beb
fix: change sql to improve the performance of catalog api (#14820)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2021-05-20 15:52:53 +08:00
Daniel Jiang
8600b06975
Merge pull request #14925 from ywk253100/210520_perf
Improve the performance of artifact related APIs
2021-05-20 14:10:45 +08:00
Wenkai Yin(尹文开)
0fe551274d
Merge pull request #14921 from ywk253100/210519_db
Clean up tech debt codes
2021-05-20 13:44:10 +08:00
Wenkai Yin(尹文开)
36d76d8704
Merge pull request #14912 from ywk253100/210518_bug
Truncate the string when deletinng the resources when the length exceeds the limit
2021-05-20 12:09:36 +08:00
Wenkai Yin
998e392bb4 Clean up tech debt codes
Clean up tech debt codes

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-20 11:47:46 +08:00
Wenkai Yin
dc059a9a8f Improve the performance of artifact related APIs
Improve the performance of artifact related APIs by adding indexes and refactoring sql logic

Closes #13890 #14813 #14814

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-20 11:25:43 +08:00
Wenkai Yin(尹文开)
08ed886936
Merge pull request #14914 from ywk253100/210518_registry
Update the field name of registry model
2021-05-19 17:20:12 +08:00
Daniel Jiang
294ee52d7a
Merge pull request #14900 from reasonerjt/rm-common-dao-getuser-onboard
Remove GetUser and Onboard from common/dao
2021-05-19 11:21:00 +08:00
Wenkai Yin
315f490d3c Update the field name of registry model
Update the field name of registry mode

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-18 17:26:20 +08:00
Wenkai Yin
5ebc8b4fdd Truncate the string when deletinng the resources when the length exceeds the limit
Truncate the string when deletinng the resources when the length exceeds the limit

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-18 17:17:41 +08:00
Daniel Jiang
952644e23f Remove GetUser and Onboard from common/dao
Replaced by funcs in src/pkg/user and src/controller/user

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-05-18 15:28:41 +08:00
He Weiwei
0c315d8aee
refactor: remove allowlist in GetSummary of scan controller (#14836)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-05-18 14:01:59 +08:00
Vadim Bauer
1a3335edc5
Provide information about missing RBAC permissions in debug mode. (#14906)
Signed-off-by: Vadim Bauer <vb@container-registry.com>

Co-authored-by: Vadim Bauer <vb@container-registry.com>
2021-05-18 10:02:34 +08:00
He Weiwei
6f3607cebd
perf: cache the metadata of the scanner (#14879)
1. Cache the metadata of scanner 30s.
2. Change the scanner client request timeout to 5s.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-05-14 14:27:37 +08:00
Daniel Jiang
fa46b0d736
Merge pull request #14095 from jsoref/tokens
Tokens
2021-05-13 13:25:58 +08:00
Wang Yan
ad9569da26
refactor preheat model (#14858)
Move the notification to preheat models

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-05-12 22:29:01 +08:00
Qian Deng
17dd48e5a3
Merge pull request #14854 from ninjadq/upgrade_helm_chart
Upgrade helm chart
2021-05-12 19:33:03 +08:00
stonezdj(Daojun Zhang)
0dfc801a50
Error string should not be capitalized (#14840)
Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-05-12 16:53:37 +08:00
Wenkai Yin
c04f3a2aac Fix duplicate execution record issue
When the core service cannot response the checkin request in time, duplicated execution records may be created, this commit introduces the revision column to make sure there is only one record for one schedule trigger

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-12 15:40:52 +08:00
Daniel Jiang
bd9a1c6722
Merge pull request #14829 from reasonerjt/user-common-dao-cleanup
Move user related funcs from common/dao
2021-05-12 10:56:18 +08:00
stonezdj(Daojun Zhang)
a6d92ca807
Merge pull request #14777 from stonezdj/21apr15_declarative_config
Implement declarative configure feature
2021-05-12 09:21:57 +08:00
Daniel Jiang
6d0e391740 Move user related funcs from common/dao
This commit moves more user related funcs, such as ChangePassword,
Login, ChangeUserProfile from common/dao to rely on /pkg/user and
pkg/oidc.
It also removes the code for resetting user's password as it's disabled.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-05-12 01:12:57 +08:00
Wang Yan
b714baae87
fixes immutable rule issue (#14849)
fixes #14568

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-05-11 23:28:03 +08:00
DQ
9a974d2b2c Upgrade Helm Client Version
From version 3.1.1 to 3.4.2

Signed-off-by: DQ <dengq@vmware.com>
2021-05-11 13:51:55 +00:00
stonezdj
3825220ca6 Implement declarative configure feature
Add env CONFIG_OVERWRITE_JSON for declarative config
Init config with the json in CONFIG_OVERWRITE_JSON in main.go

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-05-11 20:58:19 +08:00
Wenkai Yin(尹文开)
e006f4bab5
Support specifying multiple fields for default sorting (#14788)
Support specifying multiple fields for default sorting
Fixes #14433

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-05-10 17:04:10 +08:00
Daniel Jiang
8fa45a5338 Bump up go-oidc to v3
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-05-06 16:07:16 +08:00
Daniel Jiang
a66809cf85
Remove register and userexists funcs from dao pkg (#14798)
This commit replaces them with funcs with user pkg

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-05-05 17:55:56 +08:00
stonezdj(Daojun Zhang)
8f16831c75
Merge pull request #14717 from stonezdj/21pr16_verify_ldap_group_settings
Add the ldap group config validation
2021-04-30 10:19:43 +08:00
stonezdj
9010eeb832 Add the ldap group config validation
When ldap_group_search_filter is set, check other required fields
When ldap_group_search_filter is empty, skip to attach group

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-29 22:11:38 +08:00
Wang Yan
1dd3b9fd82
add storage consumption support (#14772)
Return the total storage consumption in the statistic API

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-04-29 12:36:25 +08:00
Wang Yan
f3260fdad1
move blob models (#14776)
1, move project_blob into pkg
2, move artifact_blob into pkg

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-04-29 12:36:08 +08:00
Wenkai Yin(尹文开)
9bbffa06db
Merge pull request #14662 from ywk253100/210413_dest_ns
Refactor the replication policy destination namespace logic
2021-04-29 11:18:43 +08:00
Wenkai Yin(尹文开)
30664995c7
Merge pull request #14762 from ywk253100/210427_task_not_found_master
Read upstream job ID as ID when it isn't null
2021-04-29 10:58:48 +08:00
Wenkai Yin
710c80078b Refactor the replication policy destination namespace logic
Support specifying what part of the repository will be replaced by the provided namespace

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-04-28 10:16:20 +08:00
Wenkai Yin(尹文开)
c54e690f69
Merge pull request #14702 from ywk253100/210419_metadata
Refactor project metadata API
2021-04-27 18:02:09 +08:00
Wenkai Yin
0539f051a2 Read upstream job ID as ID when it isn't null
Read upstream job ID as ID when it isn't null to fix the job not found error

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-04-27 14:47:26 +08:00
stonezdj(Daojun Zhang)
c946457eef
Return 409 instead of 500 for duplicate project member (#14727)
Fixes #14621

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-26 12:59:37 +08:00
Daniel Jiang
5b526b8dc7
Remove dependencies from pkg/oidc to common/dao (#14739)
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-04-26 10:56:49 +08:00
Wenkai Yin
311d6336a7 Refactor project metadata API
Refactor project metadata API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-04-20 22:27:17 +08:00
stonezdj(Daojun Zhang)
0b9cad33b1
Refine the code of config (#14675)
Remove deps to common/dao
 Move Manager interface to config.go
 Remove duplicate code and change format of dao.go

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-19 21:08:25 +08:00
Steven Zou
cae82dc3d0
Merge pull request #14676 from bitsf/update_adapter_region
update aliyun and aws region
2021-04-19 11:17:07 +08:00
Steven Zou
0a67e16922
Merge pull request #14677 from bitsf/fix_aws_checkRepository
fix(replication) aws adapter checkRepository
2021-04-19 11:16:05 +08:00
Ziming Zhang
e8450d99ce update aliyun and aws region
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-04-16 22:34:11 +08:00
Ziming Zhang
74bd82b3a1 fix(replication) aws adapter checkRepository
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-04-16 22:28:14 +08:00
Wenkai Yin(尹文开)
5f0e7cfd62
Merge pull request #14372 from chlins/fix/registry-auth-parse-time
fix: add precheck when registry check token expired
2021-04-16 18:17:02 +08:00
Wang Yan
6e3c9e29df
Api refactor label (#14650)
* Refactor labl api

move to the new program model

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

* continue resolve review comments

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-04-15 17:27:58 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
027c80ea58 Ignore the not found error in some cases
Ignore the not found error in some cases
Fixes #14154

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-02-03 20:26:50 +08:00
Wang Yan
1b85c67f63
fix catalog performance issue (#14120)
Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-01-31 21:31:21 +08:00
DQ
eb5e31a442 Chagne quota usage metric name
from `harbor_project_usage_byte` to `harbor_project_quota_usage_byte`

Signed-off-by: DQ <dengq@vmware.com>
2021-01-28 18:10:59 +08:00
Qian Deng
ebe05919be
Merge pull request #14078 from ninjadq/fix_self_registration_metric
Fix metric label related things
2021-01-28 17:27:53 +08:00
Josh Soref
d45ce5cbf1 Return instead of crashing when New() fails
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-01-26 20:41:18 -05:00
Josh Soref
5be895cb39 Check return from token.DefaultTokenOptions()
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-01-26 20:39:55 -05:00
DQ
a7241c1eb6 Fix: Support multiple type for artifact metrics
artiact became a dict

Signed-off-by: DQ <dengq@vmware.com>
2021-01-26 09:05:57 +00:00
DQ
66fd4a9728 change label project id to project name
project_name is more accurate

Signed-off-by: DQ <dengq@vmware.com>
2021-01-26 16:15:04 +08:00
DQ
23a02bd5a7 Fix sel registration in metric label
Original type is bool, should convert it to string

Signed-off-by: DQ <dengq@vmware.com>
2021-01-25 18:53:10 +08:00
He Weiwei
e0f7778027
fix: ignore tag in the scan webhook when it's empty (#14057)
Closes #13464

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-01-22 20:08:36 +08:00
Qian Deng
045e1d9abe
Merge pull request #14040 from ninjadq/metric_improvement
Metric improvement
2021-01-22 17:13:57 +08:00
Wenkai Yin(尹文开)
63831dfd08
Merge pull request #14027 from ywk253100/210116_status
Don't ignore the NotFoundErr when handling the status hook of tasks to avoid the status out of sync
2021-01-20 17:07:18 +08:00
Wenkai Yin
e55c7d05ff Don't ignore the NotFoundErr when handling the status hook of tasks to avoid the status out of sync
Don't ignore the NotFoundErr when handling the status hook of tasks to avoid the status out of sync
Fixes #14016

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-01-20 14:53:50 +08:00
He Weiwei
6a16d9a914
fix: correct Authorize of basic and berer authorizer (#14036)
Closes #13734

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-01-20 14:33:28 +08:00
DQ
c59b437970 Remove empty label in harbor info
some infomation can not get with guest user. So remove them

Signed-off-by: DQ <dengq@vmware.com>
2021-01-20 10:53:55 +08:00
Wenkai Yin(尹文开)
c3b986cbcd
Merge pull request #14012 from ywk253100/210113_replication
Query executions with both vendor type and ID when sweep the execution records
2021-01-18 11:15:31 +08:00
Wenkai Yin
38e0f102bf Query executions with both vendor type and ID when sweep the execution records
Query executions with both vendor type and ID when sweep the execution records

Fixes #13996

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2021-01-15 20:23:55 +08:00
Wang Yan
df8e7c45e3 fix robot list issue
fixes #13985
Add sorting for listing the robot account

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-01-15 11:56:53 +08:00
Daniel Jiang
6ae94d3790 Remove raw token from header in token review reuqest
The server to handle token-review may have a limitation for the size of
the header.  When the token is huge the token review may fail.
This commit remove the necessary header to harden the flow.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-01-14 17:36:55 +08:00
Ziming Zhang
39fb500318 feat(retention) refactor to use go swagger api
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2021-01-08 07:09:28 +00:00
Steven Zou
1f79ce1181
Merge pull request #13554 from shaobo322/reform_compare_method
reform job status compare method
2021-01-08 12:49:39 +08:00
He Weiwei
755c6490f9
feat: remove duplicate CVE in scan report and summary (#13918)
1. Remove the duplicate CVE records in the report/summary for the image
index.
2. Add scanner field in the scan overview for the API.

Closes #13913

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-01-08 11:00:43 +08:00
He Weiwei
9402077695
feat: save summary for the scan all execution (#13931)
Compute the summary info for the scan all and save it to the extra attrs
of the execution.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2021-01-08 10:10:31 +08:00