{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/comments/204690228","pull_request_review_id":139811706,"id":204690228,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDY5MDIyOA==","diff_hunk":"@@ -178,45 +159,58 @@ func RunApiserver(stopCh chan struct{}) *exec.Cmd {\n \tapiserverCmd := exec.Command(server,\n \t\tflags...,\n \t)\n-\tfmt.Printf(\"%s\\n\", strings.Join(apiserverCmd.Args, \" \"))\n \tif printapiserver {\n \t\tapiserverCmd.Stderr = os.Stderr\n \t\tapiserverCmd.Stdout = os.Stdout\n \t}\n \n-\tgo func() {\n-\t\terr := apiserverCmd.Run()\n-\t\tif err != nil {\n-\t\t\tlog.Printf(\"Failed to run apiserver %v\", err)\n-\t\t\tstopCh <- struct{}{}\n-\t\t}\n-\t}()\n+\tgo runCommon(apiserverCmd, ctx, cancel)\n \n \treturn apiserverCmd\n }\n \n-func RunControllerManager(stopCh chan struct{}) *exec.Cmd {\n+func RunControllerManager(ctx context.Context, cancel context.CancelFunc) *exec.Cmd {\n \tif len(controllermanager) == 0 {\n \t\tcontrollermanager = \"bin/controller-manager\"\n \t}\n+\n \tcontrollerManagerCmd := exec.Command(controllermanager,\n \t\tfmt.Sprintf(\"--kubeconfig=%s\", config),\n \t)\n-\tfmt.Printf(\"%s\\n\", strings.Join(controllerManagerCmd.Args, \" \"))\n \tif printcontrollermanager {\n \t\tcontrollerManagerCmd.Stderr = os.Stderr\n \t\tcontrollerManagerCmd.Stdout = os.Stdout\n \t}\n \n+\tgo runCommon(controllerManagerCmd, ctx, cancel)\n+\n+\treturn controllerManagerCmd\n+}\n+\n+// run a command via goroutine\n+func runCommon(cmd *exec.Cmd, ctx context.Context, cancel context.CancelFunc) {\n+\tstopCh := make(chan error)\n+\tcmdName := cmd.Args[0]\n+\n+\tfmt.Printf(\"%s\\n\", strings.Join(cmd.Args, \" \"))\n \tgo func() {\n-\t\terr := controllerManagerCmd.Run()\n+\t\terr := cmd.Run()\n \t\tif err != nil {\n-\t\t\tlog.Printf(\"Failed to run controller-manager %v\", err)\n-\t\t\tstopCh <- struct{}{}\n+\t\t\tlog.Printf(\"Failed to run %s, error: %v\\n\", cmdName, err)\n+\t\t\tstopCh <- err\n+\t\t} else {\n+\t\t\tstopCh <- nil\n \t\t}\n \t}()\n \n-\treturn controllerManagerCmd\n+\tselect {\n+\tcase <-stopCh:\n+\t\t// my command quited\n+\t\tcancel()\n+\tcase <-ctx.Done():\n+\t\t// other commands quited\n+\t\tcmd.Process.Kill()","path":"cmd/apiserver-boot/boot/run/local.go","position":143,"original_position":156,"commit_id":"2098e3719692f2dae851afa8f533b6186903f957","original_commit_id":"2098e3719692f2dae851afa8f533b6186903f957","user":{"login":"interma","id":61843,"node_id":"MDQ6VXNlcjYxODQz","avatar_url":"https://avatars3.githubusercontent.com/u/61843?v=4","gravatar_id":"","url":"https://api.github.com/users/interma","html_url":"https://github.com/interma","followers_url":"https://api.github.com/users/interma/followers","following_url":"https://api.github.com/users/interma/following{/other_user}","gists_url":"https://api.github.com/users/interma/gists{/gist_id}","starred_url":"https://api.github.com/users/interma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interma/subscriptions","organizations_url":"https://api.github.com/users/interma/orgs","repos_url":"https://api.github.com/users/interma/repos","events_url":"https://api.github.com/users/interma/events{/privacy}","received_events_url":"https://api.github.com/users/interma/received_events","type":"User","site_admin":false},"body":"Yes, check nil is better, I will update them later.\r\n","created_at":"2018-07-24T09:44:08Z","updated_at":"2018-07-24T09:44:08Z","html_url":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255#discussion_r204690228","pull_request_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/comments/204690228"},"html":{"href":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255#discussion_r204690228"},"pull_request":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255"}},"in_reply_to_id":204357256},"pull_request":{"url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255","id":202819345,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyODE5MzQ1","html_url":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255","diff_url":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255.diff","patch_url":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255.patch","issue_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/255","number":255,"state":"open","locked":false,"title":"Quit all processes when \"apiserver-boot run local\" failed","user":{"login":"interma","id":61843,"node_id":"MDQ6VXNlcjYxODQz","avatar_url":"https://avatars3.githubusercontent.com/u/61843?v=4","gravatar_id":"","url":"https://api.github.com/users/interma","html_url":"https://github.com/interma","followers_url":"https://api.github.com/users/interma/followers","following_url":"https://api.github.com/users/interma/following{/other_user}","gists_url":"https://api.github.com/users/interma/gists{/gist_id}","starred_url":"https://api.github.com/users/interma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interma/subscriptions","organizations_url":"https://api.github.com/users/interma/orgs","repos_url":"https://api.github.com/users/interma/repos","events_url":"https://api.github.com/users/interma/events{/privacy}","received_events_url":"https://api.github.com/users/interma/received_events","type":"User","site_admin":false},"body":"Fix:\r\nhttps://github.com/kubernetes-incubator/apiserver-builder/issues/253\r\n\r\nGlad to open my first PR, thanks for your review.\r\n","created_at":"2018-07-20T11:14:45Z","updated_at":"2018-07-24T09:44:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8196bcff6246edf29bbeabac0ed67155a836a765","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":593584923,"node_id":"MDU6TGFiZWw1OTM1ODQ5MjM=","url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"ededed","default":false},{"id":676735902,"node_id":"MDU6TGFiZWw2NzY3MzU5MDI=","url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/labels/size/L","name":"size/L","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255/commits","review_comments_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255/comments","review_comment_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/255/comments","statuses_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/statuses/2098e3719692f2dae851afa8f533b6186903f957","head":{"label":"interma:quitall_runlocal","ref":"quitall_runlocal","sha":"2098e3719692f2dae851afa8f533b6186903f957","user":{"login":"interma","id":61843,"node_id":"MDQ6VXNlcjYxODQz","avatar_url":"https://avatars3.githubusercontent.com/u/61843?v=4","gravatar_id":"","url":"https://api.github.com/users/interma","html_url":"https://github.com/interma","followers_url":"https://api.github.com/users/interma/followers","following_url":"https://api.github.com/users/interma/following{/other_user}","gists_url":"https://api.github.com/users/interma/gists{/gist_id}","starred_url":"https://api.github.com/users/interma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interma/subscriptions","organizations_url":"https://api.github.com/users/interma/orgs","repos_url":"https://api.github.com/users/interma/repos","events_url":"https://api.github.com/users/interma/events{/privacy}","received_events_url":"https://api.github.com/users/interma/received_events","type":"User","site_admin":false},"repo":{"id":141679623,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2Nzk2MjM=","name":"apiserver-builder","full_name":"interma/apiserver-builder","owner":{"login":"interma","id":61843,"node_id":"MDQ6VXNlcjYxODQz","avatar_url":"https://avatars3.githubusercontent.com/u/61843?v=4","gravatar_id":"","url":"https://api.github.com/users/interma","html_url":"https://github.com/interma","followers_url":"https://api.github.com/users/interma/followers","following_url":"https://api.github.com/users/interma/following{/other_user}","gists_url":"https://api.github.com/users/interma/gists{/gist_id}","starred_url":"https://api.github.com/users/interma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interma/subscriptions","organizations_url":"https://api.github.com/users/interma/orgs","repos_url":"https://api.github.com/users/interma/repos","events_url":"https://api.github.com/users/interma/events{/privacy}","received_events_url":"https://api.github.com/users/interma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/interma/apiserver-builder","description":"apiserver-builder implements libraries and tools to quickly and easily build Kubernetes apiservers to support custom resource types","fork":true,"url":"https://api.github.com/repos/interma/apiserver-builder","forks_url":"https://api.github.com/repos/interma/apiserver-builder/forks","keys_url":"https://api.github.com/repos/interma/apiserver-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/interma/apiserver-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/interma/apiserver-builder/teams","hooks_url":"https://api.github.com/repos/interma/apiserver-builder/hooks","issue_events_url":"https://api.github.com/repos/interma/apiserver-builder/issues/events{/number}","events_url":"https://api.github.com/repos/interma/apiserver-builder/events","assignees_url":"https://api.github.com/repos/interma/apiserver-builder/assignees{/user}","branches_url":"https://api.github.com/repos/interma/apiserver-builder/branches{/branch}","tags_url":"https://api.github.com/repos/interma/apiserver-builder/tags","blobs_url":"https://api.github.com/repos/interma/apiserver-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/interma/apiserver-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/interma/apiserver-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/interma/apiserver-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/interma/apiserver-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/interma/apiserver-builder/languages","stargazers_url":"https://api.github.com/repos/interma/apiserver-builder/stargazers","contributors_url":"https://api.github.com/repos/interma/apiserver-builder/contributors","subscribers_url":"https://api.github.com/repos/interma/apiserver-builder/subscribers","subscription_url":"https://api.github.com/repos/interma/apiserver-builder/subscription","commits_url":"https://api.github.com/repos/interma/apiserver-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/interma/apiserver-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/interma/apiserver-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/interma/apiserver-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/interma/apiserver-builder/contents/{+path}","compare_url":"https://api.github.com/repos/interma/apiserver-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/interma/apiserver-builder/merges","archive_url":"https://api.github.com/repos/interma/apiserver-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/interma/apiserver-builder/downloads","issues_url":"https://api.github.com/repos/interma/apiserver-builder/issues{/number}","pulls_url":"https://api.github.com/repos/interma/apiserver-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/interma/apiserver-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/interma/apiserver-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/interma/apiserver-builder/labels{/name}","releases_url":"https://api.github.com/repos/interma/apiserver-builder/releases{/id}","deployments_url":"https://api.github.com/repos/interma/apiserver-builder/deployments","created_at":"2018-07-20T07:35:34Z","updated_at":"2018-07-20T07:35:39Z","pushed_at":"2018-07-23T10:17:57Z","git_url":"git://github.com/interma/apiserver-builder.git","ssh_url":"git@github.com:interma/apiserver-builder.git","clone_url":"https://github.com/interma/apiserver-builder.git","svn_url":"https://github.com/interma/apiserver-builder","homepage":"","size":95100,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes-incubator:master","ref":"master","sha":"14201e804a58a140011a0044b15331f477535f91","user":{"login":"kubernetes-incubator","id":20862812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODYyODEy","avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":89638209,"node_id":"MDEwOlJlcG9zaXRvcnk4OTYzODIwOQ==","name":"apiserver-builder","full_name":"kubernetes-incubator/apiserver-builder","owner":{"login":"kubernetes-incubator","id":20862812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODYyODEy","avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes-incubator/apiserver-builder","description":"apiserver-builder implements libraries and tools to quickly and easily build Kubernetes apiservers to support custom resource types","fork":false,"url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder","forks_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/forks","keys_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/teams","hooks_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/hooks","issue_events_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/events","assignees_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/tags","blobs_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/languages","stargazers_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/stargazers","contributors_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/contributors","subscribers_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/subscribers","subscription_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/subscription","commits_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/merges","archive_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/downloads","issues_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/deployments","created_at":"2017-04-27T20:35:24Z","updated_at":"2018-07-24T06:56:40Z","pushed_at":"2018-07-23T15:42:43Z","git_url":"git://github.com/kubernetes-incubator/apiserver-builder.git","ssh_url":"git@github.com:kubernetes-incubator/apiserver-builder.git","clone_url":"https://github.com/kubernetes-incubator/apiserver-builder.git","svn_url":"https://github.com/kubernetes-incubator/apiserver-builder","homepage":"","size":95097,"stargazers_count":184,"watchers_count":184,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":81,"open_issues":42,"watchers":184,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255"},"html":{"href":"https://github.com/kubernetes-incubator/apiserver-builder/pull/255"},"issue":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/255"},"comments":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/issues/255/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/pulls/255/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes-incubator/apiserver-builder/statuses/2098e3719692f2dae851afa8f533b6186903f957"}},"author_association":"NONE"}}
{"actor":{"display_login":"interma"}}