GitHub PullRequestReviewCommentEvent at 2014-09-25 14:25:47
Repository: origin
Actor: smarterclayton
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/18034486","id":18034486,"diff_hunk":"@@ -152,3 +156,49 @@ func (p *TemplateProcessor) GenerateParameterValues(t *api.Template) error {\n \t}\n \treturn nil\n }\n+\n+// AddLabels tries to add new Label(s) to all Items in the given Template.\n+func (p *TemplateProcessor) AddLabels(t *api.Template, labels labels.Set) error {\n+\tfor i, _ := range t.Items {\n+\t\tif err := p.mergeLabels(t.Items[i].Object, labels); err != nil {\n+\t\t\treturn fmt.Errorf(\"Unable to add labels into the Template.Items[%v]: %v\", i, err)\n+\t\t}\n+\t}\n+\treturn nil\n+}\n+\n+// mergeLabels tries to merge src Labels into a dest runtime.Object that has\n+// a Labels field declared. Given the Labels field is found, it returns an\n+// error when the src and the dest are not maps of the same type and also\n+// returns an error if the dest label is already set. On the other hand, it\n+// silently ignores any dest runtime.Object with no Labels field declared.\n+func (p *TemplateProcessor) mergeLabels(dest runtime.Object, src labels.Set) error {\n+\tdestVal := reflect.ValueOf(dest).Elem().FieldByName(\"Labels\")\n+\tsrcVal := reflect.ValueOf(src)\n+\tif !destVal.IsValid() {\n+\t\t// Ignore any runtime.Object with no Labels field in its declaration.","path":"pkg/template/template.go","position":73,"original_position":76,"commit_id":"80100c28d71bce27396ab399e549bc4033727bf2","original_commit_id":"db20101757bff82500a29e7a07e61efd54346b22","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=2","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"body":"Yes, lets have a path above this that can handle special cases","created_at":"2014-09-25T14:25:47Z","updated_at":"2014-09-25T14:25:47Z","html_url":"https://github.com/openshift/origin/pull/137#discussion_r18034486","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/137","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/18034486"},"html":{"href":"https://github.com/openshift/origin/pull/137#discussion_r18034486"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/137"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/137","id":21675184,"html_url":"https://github.com/openshift/origin/pull/137","diff_url":"https://github.com/openshift/origin/pull/137.diff","patch_url":"https://github.com/openshift/origin/pull/137.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/137","number":137,"state":"open","locked":false,"title":"[WIP] Config labels","user":{"login":"VojtechVitek","id":139342,"avatar_url":"https://avatars.githubusercontent.com/u/139342?v=2","gravatar_id":"","url":"https://api.github.com/users/VojtechVitek","html_url":"https://github.com/VojtechVitek","followers_url":"https://api.github.com/users/VojtechVitek/followers","following_url":"https://api.github.com/users/VojtechVitek/following{/other_user}","gists_url":"https://api.github.com/users/VojtechVitek/gists{/gist_id}","starred_url":"https://api.github.com/users/VojtechVitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VojtechVitek/subscriptions","organizations_url":"https://api.github.com/users/VojtechVitek/orgs","repos_url":"https://api.github.com/users/VojtechVitek/repos","events_url":"https://api.github.com/users/VojtechVitek/events{/privacy}","received_events_url":"https://api.github.com/users/VojtechVitek/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-09-23T20:53:15Z","updated_at":"2014-09-25T14:25:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cba62465f4f5363def67c529d1bb444b8ea8eaf8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/137/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/137/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/137/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/80100c28d71bce27396ab399e549bc4033727bf2","head":{"label":"VojtechVitek:config_labels","ref":"config_labels","sha":"80100c28d71bce27396ab399e549bc4033727bf2","user":{"login":"VojtechVitek","id":139342,"avatar_url":"https://avatars.githubusercontent.com/u/139342?v=2","gravatar_id":"","url":"https://api.github.com/users/VojtechVitek","html_url":"https://github.com/VojtechVitek","followers_url":"https://api.github.com/users/VojtechVitek/followers","following_url":"https://api.github.com/users/VojtechVitek/following{/other_user}","gists_url":"https://api.github.com/users/VojtechVitek/gists{/gist_id}","starred_url":"https://api.github.com/users/VojtechVitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VojtechVitek/subscriptions","organizations_url":"https://api.github.com/users/VojtechVitek/orgs","repos_url":"https://api.github.com/users/VojtechVitek/repos","events_url":"https://api.github.com/users/VojtechVitek/events{/privacy}","received_events_url":"https://api.github.com/users/VojtechVitek/received_events","type":"User","site_admin":false},"repo":{"id":22925593,"name":"origin","full_name":"VojtechVitek/origin","owner":{"login":"VojtechVitek","id":139342,"avatar_url":"https://avatars.githubusercontent.com/u/139342?v=2","gravatar_id":"","url":"https://api.github.com/users/VojtechVitek","html_url":"https://github.com/VojtechVitek","followers_url":"https://api.github.com/users/VojtechVitek/followers","following_url":"https://api.github.com/users/VojtechVitek/following{/other_user}","gists_url":"https://api.github.com/users/VojtechVitek/gists{/gist_id}","starred_url":"https://api.github.com/users/VojtechVitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VojtechVitek/subscriptions","organizations_url":"https://api.github.com/users/VojtechVitek/orgs","repos_url":"https://api.github.com/users/VojtechVitek/repos","events_url":"https://api.github.com/users/VojtechVitek/events{/privacy}","received_events_url":"https://api.github.com/users/VojtechVitek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VojtechVitek/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/VojtechVitek/origin","forks_url":"https://api.github.com/repos/VojtechVitek/origin/forks","keys_url":"https://api.github.com/repos/VojtechVitek/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VojtechVitek/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VojtechVitek/origin/teams","hooks_url":"https://api.github.com/repos/VojtechVitek/origin/hooks","issue_events_url":"https://api.github.com/repos/VojtechVitek/origin/issues/events{/number}","events_url":"https://api.github.com/repos/VojtechVitek/origin/events","assignees_url":"https://api.github.com/repos/VojtechVitek/origin/assignees{/user}","branches_url":"https://api.github.com/repos/VojtechVitek/origin/branches{/branch}","tags_url":"https://api.github.com/repos/VojtechVitek/origin/tags","blobs_url":"https://api.github.com/repos/VojtechVitek/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VojtechVitek/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VojtechVitek/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/VojtechVitek/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VojtechVitek/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/VojtechVitek/origin/languages","stargazers_url":"https://api.github.com/repos/VojtechVitek/origin/stargazers","contributors_url":"https://api.github.com/repos/VojtechVitek/origin/contributors","subscribers_url":"https://api.github.com/repos/VojtechVitek/origin/subscribers","subscription_url":"https://api.github.com/repos/VojtechVitek/origin/subscription","commits_url":"https://api.github.com/repos/VojtechVitek/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/VojtechVitek/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/VojtechVitek/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/VojtechVitek/origin/issues/comments/{number}","contents_url":"https://api.github.com/repos/VojtechVitek/origin/contents/{+path}","compare_url":"https://api.github.com/repos/VojtechVitek/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VojtechVitek/origin/merges","archive_url":"https://api.github.com/repos/VojtechVitek/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VojtechVitek/origin/downloads","issues_url":"https://api.github.com/repos/VojtechVitek/origin/issues{/number}","pulls_url":"https://api.github.com/repos/VojtechVitek/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/VojtechVitek/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/VojtechVitek/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VojtechVitek/origin/labels{/name}","releases_url":"https://api.github.com/repos/VojtechVitek/origin/releases{/id}","created_at":"2014-08-13T18:01:43Z","updated_at":"2014-08-28T12:47:06Z","pushed_at":"2014-09-25T12:53:43Z","git_url":"git://github.com/VojtechVitek/origin.git","ssh_url":"git@github.com:VojtechVitek/origin.git","clone_url":"https://github.com/VojtechVitek/origin.git","svn_url":"https://github.com/VojtechVitek/origin","homepage":"https://openshift.github.io","size":8618,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"8452b8d95e68321d7e66384267dcfdcc31497997","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=2","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=2","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments/{number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2014-09-24T04:41:05Z","pushed_at":"2014-09-24T22:49:11Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"https://openshift.github.io","size":10904,"stargazers_count":100,"watchers_count":100,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":23,"forks":46,"open_issues":23,"watchers":100,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/137"},"html":{"href":"https://github.com/openshift/origin/pull/137"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/137"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/137/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/137/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/137/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/80100c28d71bce27396ab399e549bc4033727bf2"}}}}