{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/harbor/pulls/comments/188245831","pull_request_review_id":120181896,"id":188245831,"diff_hunk":"@@ -0,0 +1,97 @@\n+// Copyright (c) 2018 VMware, Inc. All Rights Reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//    http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package source\n+\n+import (\n+\t\"fmt\"\n+\n+\t\"github.com/vmware/harbor/src/common\"\n+\t\"github.com/vmware/harbor/src/common/dao\"\n+\t\"github.com/vmware/harbor/src/common/utils/log\"\n+\t\"github.com/vmware/harbor/src/replication\"\n+\t\"github.com/vmware/harbor/src/replication/models\"\n+)\n+\n+// LabelFilter filter resources according to label\n+type LabelFilter struct {\n+\tlabelID int64\n+}\n+\n+// Init ...\n+func (l *LabelFilter) Init() error {\n+\treturn nil\n+}\n+\n+// GetConvertor ...\n+func (l *LabelFilter) GetConvertor() Convertor {\n+\treturn nil\n+}\n+\n+// NewLabelFilter returns an instance of LabelFilter\n+func NewLabelFilter(labelID int64) *LabelFilter {\n+\treturn &LabelFilter{\n+\t\tlabelID: labelID,\n+\t}\n+}\n+\n+// DoFilter filter the resources according to the label\n+func (l *LabelFilter) DoFilter(items []models.FilterItem) []models.FilterItem {\n+\tcandidates := []string{}\n+\tfor _, item := range items {\n+\t\tcandidates = append(candidates, item.Value)\n+\t}\n+\tlog.Debugf(\"label filter candidates: %v\", candidates)\n+\tresult := []models.FilterItem{}\n+\tfor _, item := range items {","path":"src/replication/source/label_filter.go","position":57,"original_position":57,"commit_id":"41c59ccdc96a66839340438471df8c81117a431e","original_commit_id":"41c59ccdc96a66839340438471df8c81117a431e","user":{"login":"steven-zou","id":5753287,"avatar_url":"https://avatars0.githubusercontent.com/u/5753287?v=4","gravatar_id":"","url":"https://api.github.com/users/steven-zou","html_url":"https://github.com/steven-zou","followers_url":"https://api.github.com/users/steven-zou/followers","following_url":"https://api.github.com/users/steven-zou/following{/other_user}","gists_url":"https://api.github.com/users/steven-zou/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-zou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-zou/subscriptions","organizations_url":"https://api.github.com/users/steven-zou/orgs","repos_url":"https://api.github.com/users/steven-zou/repos","events_url":"https://api.github.com/users/steven-zou/events{/privacy}","received_events_url":"https://api.github.com/users/steven-zou/received_events","type":"User","site_admin":false},"body":"why create new struct type for 'hasLabel'?","created_at":"2018-05-15T10:59:30Z","updated_at":"2018-05-15T10:59:43Z","html_url":"https://github.com/vmware/harbor/pull/4962#discussion_r188245831","pull_request_url":"https://api.github.com/repos/vmware/harbor/pulls/4962","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/vmware/harbor/pulls/comments/188245831"},"html":{"href":"https://github.com/vmware/harbor/pull/4962#discussion_r188245831"},"pull_request":{"href":"https://api.github.com/repos/vmware/harbor/pulls/4962"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/harbor/pulls/4962","id":187756408,"html_url":"https://github.com/vmware/harbor/pull/4962","diff_url":"https://github.com/vmware/harbor/pull/4962.diff","patch_url":"https://github.com/vmware/harbor/pull/4962.patch","issue_url":"https://api.github.com/repos/vmware/harbor/issues/4962","number":4962,"state":"open","locked":false,"title":"Add label filter to filter chain","user":{"login":"ywk253100","id":5835782,"avatar_url":"https://avatars3.githubusercontent.com/u/5835782?v=4","gravatar_id":"","url":"https://api.github.com/users/ywk253100","html_url":"https://github.com/ywk253100","followers_url":"https://api.github.com/users/ywk253100/followers","following_url":"https://api.github.com/users/ywk253100/following{/other_user}","gists_url":"https://api.github.com/users/ywk253100/gists{/gist_id}","starred_url":"https://api.github.com/users/ywk253100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywk253100/subscriptions","organizations_url":"https://api.github.com/users/ywk253100/orgs","repos_url":"https://api.github.com/users/ywk253100/repos","events_url":"https://api.github.com/users/ywk253100/events{/privacy}","received_events_url":"https://api.github.com/users/ywk253100/received_events","type":"User","site_admin":false},"body":"Label filters are used to filter the resources according to the labels, adding the filters to the chain to enable the function.","created_at":"2018-05-14T08:44:28Z","updated_at":"2018-05-15T10:59:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2513983dfca5d3518cc4c4dac3a1097b105b99a","assignee":{"login":"steven-zou","id":5753287,"avatar_url":"https://avatars0.githubusercontent.com/u/5753287?v=4","gravatar_id":"","url":"https://api.github.com/users/steven-zou","html_url":"https://github.com/steven-zou","followers_url":"https://api.github.com/users/steven-zou/followers","following_url":"https://api.github.com/users/steven-zou/following{/other_user}","gists_url":"https://api.github.com/users/steven-zou/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-zou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-zou/subscriptions","organizations_url":"https://api.github.com/users/steven-zou/orgs","repos_url":"https://api.github.com/users/steven-zou/repos","events_url":"https://api.github.com/users/steven-zou/events{/privacy}","received_events_url":"https://api.github.com/users/steven-zou/received_events","type":"User","site_admin":false},"assignees":[{"login":"steven-zou","id":5753287,"avatar_url":"https://avatars0.githubusercontent.com/u/5753287?v=4","gravatar_id":"","url":"https://api.github.com/users/steven-zou","html_url":"https://github.com/steven-zou","followers_url":"https://api.github.com/users/steven-zou/followers","following_url":"https://api.github.com/users/steven-zou/following{/other_user}","gists_url":"https://api.github.com/users/steven-zou/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-zou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-zou/subscriptions","organizations_url":"https://api.github.com/users/steven-zou/orgs","repos_url":"https://api.github.com/users/steven-zou/repos","events_url":"https://api.github.com/users/steven-zou/events{/privacy}","received_events_url":"https://api.github.com/users/steven-zou/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"reasonerjt","id":2390463,"avatar_url":"https://avatars0.githubusercontent.com/u/2390463?v=4","gravatar_id":"","url":"https://api.github.com/users/reasonerjt","html_url":"https://github.com/reasonerjt","followers_url":"https://api.github.com/users/reasonerjt/followers","following_url":"https://api.github.com/users/reasonerjt/following{/other_user}","gists_url":"https://api.github.com/users/reasonerjt/gists{/gist_id}","starred_url":"https://api.github.com/users/reasonerjt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reasonerjt/subscriptions","organizations_url":"https://api.github.com/users/reasonerjt/orgs","repos_url":"https://api.github.com/users/reasonerjt/repos","events_url":"https://api.github.com/users/reasonerjt/events{/privacy}","received_events_url":"https://api.github.com/users/reasonerjt/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":350773817,"url":"https://api.github.com/repos/vmware/harbor/labels/cla-not-required","name":"cla-not-required","color":"159818","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/vmware/harbor/pulls/4962/commits","review_comments_url":"https://api.github.com/repos/vmware/harbor/pulls/4962/comments","review_comment_url":"https://api.github.com/repos/vmware/harbor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/harbor/issues/4962/comments","statuses_url":"https://api.github.com/repos/vmware/harbor/statuses/41c59ccdc96a66839340438471df8c81117a431e","head":{"label":"ywk253100:180509_label_filter","ref":"180509_label_filter","sha":"41c59ccdc96a66839340438471df8c81117a431e","user":{"login":"ywk253100","id":5835782,"avatar_url":"https://avatars3.githubusercontent.com/u/5835782?v=4","gravatar_id":"","url":"https://api.github.com/users/ywk253100","html_url":"https://github.com/ywk253100","followers_url":"https://api.github.com/users/ywk253100/followers","following_url":"https://api.github.com/users/ywk253100/following{/other_user}","gists_url":"https://api.github.com/users/ywk253100/gists{/gist_id}","starred_url":"https://api.github.com/users/ywk253100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywk253100/subscriptions","organizations_url":"https://api.github.com/users/ywk253100/orgs","repos_url":"https://api.github.com/users/ywk253100/repos","events_url":"https://api.github.com/users/ywk253100/events{/privacy}","received_events_url":"https://api.github.com/users/ywk253100/received_events","type":"User","site_admin":false},"repo":{"id":53016174,"name":"harbor","full_name":"ywk253100/harbor","owner":{"login":"ywk253100","id":5835782,"avatar_url":"https://avatars3.githubusercontent.com/u/5835782?v=4","gravatar_id":"","url":"https://api.github.com/users/ywk253100","html_url":"https://github.com/ywk253100","followers_url":"https://api.github.com/users/ywk253100/followers","following_url":"https://api.github.com/users/ywk253100/following{/other_user}","gists_url":"https://api.github.com/users/ywk253100/gists{/gist_id}","starred_url":"https://api.github.com/users/ywk253100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ywk253100/subscriptions","organizations_url":"https://api.github.com/users/ywk253100/orgs","repos_url":"https://api.github.com/users/ywk253100/repos","events_url":"https://api.github.com/users/ywk253100/events{/privacy}","received_events_url":"https://api.github.com/users/ywk253100/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ywk253100/harbor","description":null,"fork":true,"url":"https://api.github.com/repos/ywk253100/harbor","forks_url":"https://api.github.com/repos/ywk253100/harbor/forks","keys_url":"https://api.github.com/repos/ywk253100/harbor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ywk253100/harbor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ywk253100/harbor/teams","hooks_url":"https://api.github.com/repos/ywk253100/harbor/hooks","issue_events_url":"https://api.github.com/repos/ywk253100/harbor/issues/events{/number}","events_url":"https://api.github.com/repos/ywk253100/harbor/events","assignees_url":"https://api.github.com/repos/ywk253100/harbor/assignees{/user}","branches_url":"https://api.github.com/repos/ywk253100/harbor/branches{/branch}","tags_url":"https://api.github.com/repos/ywk253100/harbor/tags","blobs_url":"https://api.github.com/repos/ywk253100/harbor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ywk253100/harbor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ywk253100/harbor/git/refs{/sha}","trees_url":"https://api.github.com/repos/ywk253100/harbor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ywk253100/harbor/statuses/{sha}","languages_url":"https://api.github.com/repos/ywk253100/harbor/languages","stargazers_url":"https://api.github.com/repos/ywk253100/harbor/stargazers","contributors_url":"https://api.github.com/repos/ywk253100/harbor/contributors","subscribers_url":"https://api.github.com/repos/ywk253100/harbor/subscribers","subscription_url":"https://api.github.com/repos/ywk253100/harbor/subscription","commits_url":"https://api.github.com/repos/ywk253100/harbor/commits{/sha}","git_commits_url":"https://api.github.com/repos/ywk253100/harbor/git/commits{/sha}","comments_url":"https://api.github.com/repos/ywk253100/harbor/comments{/number}","issue_comment_url":"https://api.github.com/repos/ywk253100/harbor/issues/comments{/number}","contents_url":"https://api.github.com/repos/ywk253100/harbor/contents/{+path}","compare_url":"https://api.github.com/repos/ywk253100/harbor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ywk253100/harbor/merges","archive_url":"https://api.github.com/repos/ywk253100/harbor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ywk253100/harbor/downloads","issues_url":"https://api.github.com/repos/ywk253100/harbor/issues{/number}","pulls_url":"https://api.github.com/repos/ywk253100/harbor/pulls{/number}","milestones_url":"https://api.github.com/repos/ywk253100/harbor/milestones{/number}","notifications_url":"https://api.github.com/repos/ywk253100/harbor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ywk253100/harbor/labels{/name}","releases_url":"https://api.github.com/repos/ywk253100/harbor/releases{/id}","deployments_url":"https://api.github.com/repos/ywk253100/harbor/deployments","created_at":"2016-03-03T03:06:09Z","updated_at":"2016-08-02T08:48:29Z","pushed_at":"2018-05-15T07:51:08Z","git_url":"git://github.com/ywk253100/harbor.git","ssh_url":"git@github.com:ywk253100/harbor.git","clone_url":"https://github.com/ywk253100/harbor.git","svn_url":"https://github.com/ywk253100/harbor","homepage":null,"size":78344,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"vmware:master","ref":"master","sha":"b537ea96f3bcc5b9fc7d485e797613efa699e45b","user":{"login":"vmware","id":473334,"avatar_url":"https://avatars0.githubusercontent.com/u/473334?v=4","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"repo":{"id":50613991,"name":"harbor","full_name":"vmware/harbor","owner":{"login":"vmware","id":473334,"avatar_url":"https://avatars0.githubusercontent.com/u/473334?v=4","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vmware/harbor","description":"An enterprise-class container registry server based on Docker Distribution","fork":false,"url":"https://api.github.com/repos/vmware/harbor","forks_url":"https://api.github.com/repos/vmware/harbor/forks","keys_url":"https://api.github.com/repos/vmware/harbor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/harbor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/harbor/teams","hooks_url":"https://api.github.com/repos/vmware/harbor/hooks","issue_events_url":"https://api.github.com/repos/vmware/harbor/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/harbor/events","assignees_url":"https://api.github.com/repos/vmware/harbor/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/harbor/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/harbor/tags","blobs_url":"https://api.github.com/repos/vmware/harbor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/harbor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/harbor/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/harbor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/harbor/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/harbor/languages","stargazers_url":"https://api.github.com/repos/vmware/harbor/stargazers","contributors_url":"https://api.github.com/repos/vmware/harbor/contributors","subscribers_url":"https://api.github.com/repos/vmware/harbor/subscribers","subscription_url":"https://api.github.com/repos/vmware/harbor/subscription","commits_url":"https://api.github.com/repos/vmware/harbor/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/harbor/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/harbor/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/harbor/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/harbor/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/harbor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/harbor/merges","archive_url":"https://api.github.com/repos/vmware/harbor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/harbor/downloads","issues_url":"https://api.github.com/repos/vmware/harbor/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/harbor/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/harbor/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/harbor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/harbor/labels{/name}","releases_url":"https://api.github.com/repos/vmware/harbor/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/harbor/deployments","created_at":"2016-01-28T21:10:28Z","updated_at":"2018-05-15T10:41:24Z","pushed_at":"2018-05-15T10:41:16Z","git_url":"git://github.com/vmware/harbor.git","ssh_url":"git@github.com:vmware/harbor.git","clone_url":"https://github.com/vmware/harbor.git","svn_url":"https://github.com/vmware/harbor","homepage":"http://vmware.github.io/harbor/","size":80993,"stargazers_count":4225,"watchers_count":4225,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1188,"mirror_url":null,"archived":false,"open_issues_count":519,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1188,"open_issues":519,"watchers":4225,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/harbor/pulls/4962"},"html":{"href":"https://github.com/vmware/harbor/pull/4962"},"issue":{"href":"https://api.github.com/repos/vmware/harbor/issues/4962"},"comments":{"href":"https://api.github.com/repos/vmware/harbor/issues/4962/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/harbor/pulls/4962/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/harbor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/harbor/pulls/4962/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/harbor/statuses/41c59ccdc96a66839340438471df8c81117a431e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"steven-zou"}}