{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/26131069","id":26131069,"diff_hunk":"@@ -0,0 +1,162 @@\n+package buildchain\n+\n+import (\n+\t\"fmt\"\n+\t\"os\"\n+\n+\t// \"code.google.com/p/gographviz\"\n+\tcmdutil \"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util\"\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/labels\"\n+\t\"github.com/golang/glog\"\n+\t\"github.com/spf13/cobra\"\n+\n+\tbuildapi \"github.com/openshift/origin/pkg/build/api\"\n+\t\"github.com/openshift/origin/pkg/client\"\n+\t\"github.com/openshift/origin/pkg/cmd/util/clientcmd\"\n+\t_ \"github.com/openshift/origin/pkg/image/api\"\n+\tval \"github.com/openshift/origin/pkg/image/api/validation\"\n+)\n+\n+// node is a representation of a node inside a tree\n+type node struct {\n+\tname     string\n+\ttags     []string\n+\tchildren []*node\n+}\n+\n+// String helps in pretty-printing a tree\n+func (root *node) String() string {\n+\ttree := \"\"\n+\ttree += root.name\n+\n+\tfor _, n := range root.children {\n+\t\ttree += \"(\" + n.String() + \")\"\n+\t}\n+\n+\treturn tree\n+}\n+\n+const longDescription = `Experimental command\n+\n+Output build dependencies of a specific image repository.\n+\n+Examples:\n+\n+    $ openshift ex build-chain [image-repository]\n+`\n+\n+func NewCmdBuildChain(f *clientcmd.Factory, parentName, name string) *cobra.Command {\n+\tcmd := &cobra.Command{\n+\t\tUse:   fmt.Sprintf(\"%s [image-repository]\", name),\n+\t\tShort: \"Output build dependencies of a specific image repository\",\n+\t\tLong:  longDescription,\n+\t\tRun: func(cmd *cobra.Command, args []string) {\n+\t\t\timageRepoName := cmdutil.GetFlagString(cmd, \"imagerepo\")\n+\t\t\tif imageRepoName == \"\" {\n+\t\t\t\tusageError(cmd, \"Must pass an image repository name with the --imagerepo (-i) flag\")","path":"pkg/cmd/experimental/buildchain/buildchain.go","position":56,"original_position":56,"commit_id":"c6f75921a8fca89acbcf818fb975cc307880bbbf","original_commit_id":"c6f75921a8fca89acbcf818fb975cc307880bbbf","user":{"login":"kargakis","id":3900799,"avatar_url":"https://avatars.githubusercontent.com/u/3900799?v=3","gravatar_id":"","url":"https://api.github.com/users/kargakis","html_url":"https://github.com/kargakis","followers_url":"https://api.github.com/users/kargakis/followers","following_url":"https://api.github.com/users/kargakis/following{/other_user}","gists_url":"https://api.github.com/users/kargakis/gists{/gist_id}","starred_url":"https://api.github.com/users/kargakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kargakis/subscriptions","organizations_url":"https://api.github.com/users/kargakis/orgs","repos_url":"https://api.github.com/users/kargakis/repos","events_url":"https://api.github.com/users/kargakis/events{/privacy}","received_events_url":"https://api.github.com/users/kargakis/received_events","type":"User","site_admin":false},"body":"Good catch, I'll just use the first argument.","created_at":"2015-03-10T15:21:12Z","updated_at":"2015-03-10T15:21:12Z","html_url":"https://github.com/openshift/origin/pull/1229#discussion_r26131069","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/1229","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/26131069"},"html":{"href":"https://github.com/openshift/origin/pull/1229#discussion_r26131069"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/1229"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/1229","id":30560551,"html_url":"https://github.com/openshift/origin/pull/1229","diff_url":"https://github.com/openshift/origin/pull/1229.diff","patch_url":"https://github.com/openshift/origin/pull/1229.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/1229","number":1229,"state":"open","locked":false,"title":"[WIP] Add command line utility to output build dependencies of a specific image repository","user":{"login":"kargakis","id":3900799,"avatar_url":"https://avatars.githubusercontent.com/u/3900799?v=3","gravatar_id":"","url":"https://api.github.com/users/kargakis","html_url":"https://github.com/kargakis","followers_url":"https://api.github.com/users/kargakis/followers","following_url":"https://api.github.com/users/kargakis/following{/other_user}","gists_url":"https://api.github.com/users/kargakis/gists{/gist_id}","starred_url":"https://api.github.com/users/kargakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kargakis/subscriptions","organizations_url":"https://api.github.com/users/kargakis/orgs","repos_url":"https://api.github.com/users/kargakis/repos","events_url":"https://api.github.com/users/kargakis/events{/privacy}","received_events_url":"https://api.github.com/users/kargakis/received_events","type":"User","site_admin":false},"body":"cc: @csrwng @smarterclayton @bparees \r\n\r\nOpening this issue to sync with [this](https://trello.com/c/52pEs31Q/510-add-command-line-utility-to-output-build-dependencies-of-a-specific-image-repository) Trello card.\r\n\r\n> Simple json (step one), dot or other easy visualization graph format (step 2). Choose the internal structures so they work for dot. For now, define an internal type you can directly serialize to json. In the future we might version it. Put it under experimental admin.\r\n\r\n@smarterclayton I was thinking of going straight to the dot stuff. There is a library that can make things very easy with creating DOT files: https://godoc.org/code.google.com/p/gographviz\r\nWhat do you think?\r\n\r\nDisclaimer: I haven't used that library but with a look I had on it it looks fine plus I am already familiar with GraphViz and the DOT syntax\r\n\r\n**UPDATE**\r\n\r\nThis is a work in progress and any feedback is welcome:)","created_at":"2015-03-05T14:26:23Z","updated_at":"2015-03-10T15:21:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b646a00a4f479ed80537239372664db345fd41ba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/1229/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/1229/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/1229/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/c6f75921a8fca89acbcf818fb975cc307880bbbf","head":{"label":"kargakis:output-dep","ref":"output-dep","sha":"c6f75921a8fca89acbcf818fb975cc307880bbbf","user":{"login":"kargakis","id":3900799,"avatar_url":"https://avatars.githubusercontent.com/u/3900799?v=3","gravatar_id":"","url":"https://api.github.com/users/kargakis","html_url":"https://github.com/kargakis","followers_url":"https://api.github.com/users/kargakis/followers","following_url":"https://api.github.com/users/kargakis/following{/other_user}","gists_url":"https://api.github.com/users/kargakis/gists{/gist_id}","starred_url":"https://api.github.com/users/kargakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kargakis/subscriptions","organizations_url":"https://api.github.com/users/kargakis/orgs","repos_url":"https://api.github.com/users/kargakis/repos","events_url":"https://api.github.com/users/kargakis/events{/privacy}","received_events_url":"https://api.github.com/users/kargakis/received_events","type":"User","site_admin":false},"repo":{"id":29889288,"name":"origin","full_name":"kargakis/origin","owner":{"login":"kargakis","id":3900799,"avatar_url":"https://avatars.githubusercontent.com/u/3900799?v=3","gravatar_id":"","url":"https://api.github.com/users/kargakis","html_url":"https://github.com/kargakis","followers_url":"https://api.github.com/users/kargakis/followers","following_url":"https://api.github.com/users/kargakis/following{/other_user}","gists_url":"https://api.github.com/users/kargakis/gists{/gist_id}","starred_url":"https://api.github.com/users/kargakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kargakis/subscriptions","organizations_url":"https://api.github.com/users/kargakis/orgs","repos_url":"https://api.github.com/users/kargakis/repos","events_url":"https://api.github.com/users/kargakis/events{/privacy}","received_events_url":"https://api.github.com/users/kargakis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kargakis/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/kargakis/origin","forks_url":"https://api.github.com/repos/kargakis/origin/forks","keys_url":"https://api.github.com/repos/kargakis/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kargakis/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kargakis/origin/teams","hooks_url":"https://api.github.com/repos/kargakis/origin/hooks","issue_events_url":"https://api.github.com/repos/kargakis/origin/issues/events{/number}","events_url":"https://api.github.com/repos/kargakis/origin/events","assignees_url":"https://api.github.com/repos/kargakis/origin/assignees{/user}","branches_url":"https://api.github.com/repos/kargakis/origin/branches{/branch}","tags_url":"https://api.github.com/repos/kargakis/origin/tags","blobs_url":"https://api.github.com/repos/kargakis/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kargakis/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kargakis/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/kargakis/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kargakis/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/kargakis/origin/languages","stargazers_url":"https://api.github.com/repos/kargakis/origin/stargazers","contributors_url":"https://api.github.com/repos/kargakis/origin/contributors","subscribers_url":"https://api.github.com/repos/kargakis/origin/subscribers","subscription_url":"https://api.github.com/repos/kargakis/origin/subscription","commits_url":"https://api.github.com/repos/kargakis/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/kargakis/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/kargakis/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/kargakis/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/kargakis/origin/contents/{+path}","compare_url":"https://api.github.com/repos/kargakis/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kargakis/origin/merges","archive_url":"https://api.github.com/repos/kargakis/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kargakis/origin/downloads","issues_url":"https://api.github.com/repos/kargakis/origin/issues{/number}","pulls_url":"https://api.github.com/repos/kargakis/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/kargakis/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/kargakis/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kargakis/origin/labels{/name}","releases_url":"https://api.github.com/repos/kargakis/origin/releases{/id}","created_at":"2015-01-27T00:24:14Z","updated_at":"2015-03-10T13:44:57Z","pushed_at":"2015-03-10T13:45:38Z","git_url":"git://github.com/kargakis/origin.git","ssh_url":"git@github.com:kargakis/origin.git","clone_url":"https://github.com/kargakis/origin.git","svn_url":"https://github.com/kargakis/origin","homepage":"https://openshift.github.io","size":44601,"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":"479dbbdf1f7a523eb6d91b7ebfad3fb4a3a32904","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","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=3","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":"2015-03-09T19:31:05Z","pushed_at":"2015-03-09T19:31:05Z","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":"http://www.openshift.org","size":70498,"stargazers_count":307,"watchers_count":307,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":107,"forks":163,"open_issues":107,"watchers":307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/1229"},"html":{"href":"https://github.com/openshift/origin/pull/1229"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/1229"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/1229/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/1229/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/1229/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/c6f75921a8fca89acbcf818fb975cc307880bbbf"}}}}