{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/23406587","id":23406587,"diff_hunk":"@@ -51,39 +58,77 @@ func (bc *BuildController) HandleBuild(build *buildapi.Build) {\n \t\treturn\n \t}\n \n-\tnextStatus := buildapi.BuildStatusFailed\n-\tbuild.PodName = fmt.Sprintf(\"build-%s\", build.Name)\n+\tif err := bc.nextBuildStatus(build); err != nil {\n+\t\tglog.V(4).Infof(\"Build failed with error %s/%s: %#v\", build.Namespace, build.Name, err)\n+\t\tbuild.Status = buildapi.BuildStatusError\n+\t\tbuild.Message = err.Error()\n+\t}\n \n+\tif _, err := bc.BuildUpdater.UpdateBuild(build.Namespace, build); err != nil {\n+\t\tglog.V(2).Infof(\"Failed to record changes to build %s/%s: %#v\", build.Namespace, build.Name, err)\n+\t}\n+}\n+\n+// nextBuildStatus updates build with any appropriate changes, or returns an error if\n+// the change cannot occur. When returning nil, be sure to set build.Status and optionally\n+// build.Message.\n+func (bc *BuildController) nextBuildStatus(build *buildapi.Build) error {\n \t// If a cancelling event was triggered for the build, update build status.\n \tif build.Cancelled {\n-\t\tglog.V(2).Infof(\"Cancelling build %s.\", build.Name)\n-\t\tnextStatus = buildapi.BuildStatusCancelled\n-\n-\t} else {\n-\n-\t\tvar podSpec *kapi.Pod\n-\t\tvar err error\n-\t\tif podSpec, err = bc.BuildStrategy.CreateBuildPod(build); err != nil {\n-\t\t\tglog.V(2).Infof(\"Strategy failed to create build pod definition: %v\", err)\n-\t\t\tnextStatus = buildapi.BuildStatusFailed\n-\t\t} else {\n-\n-\t\t\tif _, err := bc.PodManager.CreatePod(build.Namespace, podSpec); err != nil {\n-\t\t\t\tif !errors.IsAlreadyExists(err) {\n-\t\t\t\t\tglog.V(2).Infof(\"Failed to create pod for build %s: %#v\", build.Name, err)\n-\t\t\t\t\tnextStatus = buildapi.BuildStatusFailed\n-\t\t\t\t}\n-\t\t\t} else {\n-\t\t\t\tglog.V(2).Infof(\"Created build pod: %#v\", podSpec)\n-\t\t\t\tnextStatus = buildapi.BuildStatusPending\n+\t\tglog.V(4).Infof(\"Cancelling build %s.\", build.Name)\n+\t\tbuild.Status = buildapi.BuildStatusCancelled\n+\t\treturn nil\n+\t}\n+\n+\t// lookup the destination from the referenced image repository\n+\tspec := build.Parameters.Output.DockerImageReference","path":"pkg/build/controller/controller.go","position":80,"original_position":77,"commit_id":"1b08b7f72bd8e45ddb1c2b5bfbdfefb904bdff8d","original_commit_id":"01e937f40ad287a115b6bf7ff35d52e33ffd773d","user":{"login":"ironcladlou","id":298299,"avatar_url":"https://avatars.githubusercontent.com/u/298299?v=3","gravatar_id":"","url":"https://api.github.com/users/ironcladlou","html_url":"https://github.com/ironcladlou","followers_url":"https://api.github.com/users/ironcladlou/followers","following_url":"https://api.github.com/users/ironcladlou/following{/other_user}","gists_url":"https://api.github.com/users/ironcladlou/gists{/gist_id}","starred_url":"https://api.github.com/users/ironcladlou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ironcladlou/subscriptions","organizations_url":"https://api.github.com/users/ironcladlou/orgs","repos_url":"https://api.github.com/users/ironcladlou/repos","events_url":"https://api.github.com/users/ironcladlou/events{/privacy}","received_events_url":"https://api.github.com/users/ironcladlou/received_events","type":"User","site_admin":false},"body":"Agree with the error/retry vs. failure semantics.","created_at":"2015-01-22T20:23:29Z","updated_at":"2015-01-22T20:23:29Z","html_url":"https://github.com/openshift/origin/pull/679#discussion_r23406587","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/679","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/23406587"},"html":{"href":"https://github.com/openshift/origin/pull/679#discussion_r23406587"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/679"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/679","id":27654316,"html_url":"https://github.com/openshift/origin/pull/679","diff_url":"https://github.com/openshift/origin/pull/679.diff","patch_url":"https://github.com/openshift/origin/pull/679.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/679","number":679,"state":"open","locked":false,"title":"Allow builds to reference image repositories by name","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","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":"First two parts of a three part change (the third part is ensuring the default\nregistry is configured automatically). \n\nGeneralized cleanup of build code, including more validations, handling build\nerror states, and encoding build JSON into the build pod as our external (not\ninternal) schema.","created_at":"2015-01-20T05:08:58Z","updated_at":"2015-01-22T20:23:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e6905949afeaccab9bc4d4326c7d10c067ebccc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/679/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/679/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/679/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/1b08b7f72bd8e45ddb1c2b5bfbdfefb904bdff8d","head":{"label":"smarterclayton:reference_build_output","ref":"reference_build_output","sha":"1b08b7f72bd8e45ddb1c2b5bfbdfefb904bdff8d","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","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},"repo":{"id":22921364,"name":"origin","full_name":"smarterclayton/origin","owner":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","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},"private":false,"html_url":"https://github.com/smarterclayton/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/smarterclayton/origin","forks_url":"https://api.github.com/repos/smarterclayton/origin/forks","keys_url":"https://api.github.com/repos/smarterclayton/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smarterclayton/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smarterclayton/origin/teams","hooks_url":"https://api.github.com/repos/smarterclayton/origin/hooks","issue_events_url":"https://api.github.com/repos/smarterclayton/origin/issues/events{/number}","events_url":"https://api.github.com/repos/smarterclayton/origin/events","assignees_url":"https://api.github.com/repos/smarterclayton/origin/assignees{/user}","branches_url":"https://api.github.com/repos/smarterclayton/origin/branches{/branch}","tags_url":"https://api.github.com/repos/smarterclayton/origin/tags","blobs_url":"https://api.github.com/repos/smarterclayton/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smarterclayton/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smarterclayton/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/smarterclayton/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smarterclayton/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/smarterclayton/origin/languages","stargazers_url":"https://api.github.com/repos/smarterclayton/origin/stargazers","contributors_url":"https://api.github.com/repos/smarterclayton/origin/contributors","subscribers_url":"https://api.github.com/repos/smarterclayton/origin/subscribers","subscription_url":"https://api.github.com/repos/smarterclayton/origin/subscription","commits_url":"https://api.github.com/repos/smarterclayton/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/smarterclayton/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/smarterclayton/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/smarterclayton/origin/issues/comments/{number}","contents_url":"https://api.github.com/repos/smarterclayton/origin/contents/{+path}","compare_url":"https://api.github.com/repos/smarterclayton/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smarterclayton/origin/merges","archive_url":"https://api.github.com/repos/smarterclayton/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smarterclayton/origin/downloads","issues_url":"https://api.github.com/repos/smarterclayton/origin/issues{/number}","pulls_url":"https://api.github.com/repos/smarterclayton/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/smarterclayton/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/smarterclayton/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smarterclayton/origin/labels{/name}","releases_url":"https://api.github.com/repos/smarterclayton/origin/releases{/id}","created_at":"2014-08-13T15:49:23Z","updated_at":"2014-08-13T15:47:38Z","pushed_at":"2015-01-22T04:30:32Z","git_url":"git://github.com/smarterclayton/origin.git","ssh_url":"git@github.com:smarterclayton/origin.git","clone_url":"https://github.com/smarterclayton/origin.git","svn_url":"https://github.com/smarterclayton/origin","homepage":"https://openshift.github.io","size":23085,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"ed60f9fa6925f8f442f8bf36ba4279803349853c","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-01-22T20:03:29Z","pushed_at":"2015-01-22T20:03:29Z","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":36304,"stargazers_count":237,"watchers_count":237,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":79,"forks":131,"open_issues":79,"watchers":237,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/679"},"html":{"href":"https://github.com/openshift/origin/pull/679"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/679"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/679/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/679/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/679/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/1b08b7f72bd8e45ddb1c2b5bfbdfefb904bdff8d"}}}}