{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/52025263","id":52025263,"diff_hunk":"@@ -412,6 +416,89 @@ type SourceBuildStrategy struct {\n \tForcePull bool\n }\n \n+// A BuildPostCommitSpec holds a build post commit hook specification. The hook\n+// executes a command in a temporary container running the build output image,\n+// immediately after the last layer of the image is commited and before the\n+// image is pushed to a registry. The command is executed with the current\n+// working directory ($PWD) set to the image's WORKDIR.\n+//\n+// The build will be marked as failed if the hook execution fails. It will fail\n+// if the script or command return a non-zero exit code, or if there is any\n+// other error related to starting the temporary container.\n+//\n+// There are five different ways to configure the hook. As an example, all forms\n+// below are equivalent and will execute `rake test --verbose`.\n+//\n+// 1. Shell script:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tScript: \"rake test --verbose\",\n+// \t}\n+//\n+// The above is a convenient form which is equivalent to:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tCommand: []string{\"/bin/sh\", \"-c\"},\n+// \t\tArgs: []string{\"rake test --verbose\"},\n+// \t}\n+//\n+// 2. Command as the image entrypoint:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tCommand: []string{\"rake\", \"test\", \"--verbose\"},\n+// \t}\n+//\n+// Command overrides the image entrypoint in the exec form, as documented in\n+// Docker: https://docs.docker.com/engine/reference/builder/#entrypoint.\n+//\n+// 3. Pass arguments to the default entrypoint:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tArgs: []string{\"rake\", \"test\", \"--verbose\"},\n+// \t}\n+//\n+// This form is only useful if the image entrypoint can handle arguments.\n+//\n+// 4. Shell script with arguments:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tScript: \"rake test $1\",\n+// \t\tArgs: []string{\"--verbose\"},\n+// \t}\n+//\n+// This form is useful if you need to pass arguments that would otherwise be\n+// hard to quote properly in the shell script. In the script, $0 will be\n+// \"/bin/sh\" and $1, $2, etc, are the positional arguments from Args.\n+//\n+// 5. Command with arguments:\n+//\n+// \tBuildPostCommitSpec{\n+// \t\tCommand: []string{\"rake\", \"test\"},\n+// \t\tArgs: []string{\"--verbose\"},\n+// \t}\n+//\n+// This form is equivalent to appending the arguments to the Command slice.\n+//\n+// It is invalid to provide both Script and Command simultaneously. If none of\n+// the fields are specified, the hook is not executed.\n+type BuildPostCommitSpec struct {","path":"pkg/build/api/types.go","position":80,"original_position":80,"commit_id":"9a737499da8b1e885d5c5247762277f91911e3ed","original_commit_id":"11e6a8e87b356ab08ad2e557df1e5f032ac644fb","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"body":"@smarterclayton comments addressed, v1 and v1beta3 updated.","created_at":"2016-02-05T15:01:53Z","updated_at":"2016-02-05T15:01:53Z","html_url":"https://github.com/openshift/origin/pull/6715#discussion_r52025263","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/6715","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/52025263"},"html":{"href":"https://github.com/openshift/origin/pull/6715#discussion_r52025263"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/6715"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/6715","id":56471452,"html_url":"https://github.com/openshift/origin/pull/6715","diff_url":"https://github.com/openshift/origin/pull/6715.diff","patch_url":"https://github.com/openshift/origin/pull/6715.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/6715","number":6715,"state":"open","locked":false,"title":"[WIP] Run user-provided command as part of build flow","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"body":"This is meant to be used for running project unit tests as part of a build.\r\n\r\nTrello card: https://trello.com/c/I1v1YeOf\r\nCloses #6758\r\n\r\nThis PR/card won't introduce changes to `oc new-build` nor `oc new-app` nor the Web Console.\r\nFor now, the feature can be used via `oc edit bc`.\r\n\r\n-----------------------\r\nPending work:\r\n- [ ] agreement on API changes\r\n- [x] tests\r\n- [x] clean up\r\n- [ ] maybe move some code to source-to-image\r\n- [ ] if build fails because of failure in the post commit hook, there should be a clear error message to reflect that (see [pkg/build/builder/common.go#L56](https://github.com/openshift/origin/blob/1f99c77a509d2bf179e948c17c68332462811e35/pkg/build/builder/common.go#L56) and [pkg/build/registry/build/strategy.go#L103](https://github.com/openshift/origin/blob/1f99c77a509d2bf179e948c17c68332462811e35/pkg/build/registry/build/strategy.go#L103))","created_at":"2016-01-19T14:18:59Z","updated_at":"2016-02-05T15:01:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"047cc78682048ced24b385c0d8ed5c3a955ecc49","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/6715/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/6715/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/6715/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/9a737499da8b1e885d5c5247762277f91911e3ed","head":{"label":"rhcarvalho:build-post-commit-pre-push-usr-cmd","ref":"build-post-commit-pre-push-usr-cmd","sha":"9a737499da8b1e885d5c5247762277f91911e3ed","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"repo":{"id":30794668,"name":"origin","full_name":"rhcarvalho/origin","owner":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhcarvalho/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/rhcarvalho/origin","forks_url":"https://api.github.com/repos/rhcarvalho/origin/forks","keys_url":"https://api.github.com/repos/rhcarvalho/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhcarvalho/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhcarvalho/origin/teams","hooks_url":"https://api.github.com/repos/rhcarvalho/origin/hooks","issue_events_url":"https://api.github.com/repos/rhcarvalho/origin/issues/events{/number}","events_url":"https://api.github.com/repos/rhcarvalho/origin/events","assignees_url":"https://api.github.com/repos/rhcarvalho/origin/assignees{/user}","branches_url":"https://api.github.com/repos/rhcarvalho/origin/branches{/branch}","tags_url":"https://api.github.com/repos/rhcarvalho/origin/tags","blobs_url":"https://api.github.com/repos/rhcarvalho/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhcarvalho/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhcarvalho/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhcarvalho/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhcarvalho/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/rhcarvalho/origin/languages","stargazers_url":"https://api.github.com/repos/rhcarvalho/origin/stargazers","contributors_url":"https://api.github.com/repos/rhcarvalho/origin/contributors","subscribers_url":"https://api.github.com/repos/rhcarvalho/origin/subscribers","subscription_url":"https://api.github.com/repos/rhcarvalho/origin/subscription","commits_url":"https://api.github.com/repos/rhcarvalho/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhcarvalho/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhcarvalho/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhcarvalho/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhcarvalho/origin/contents/{+path}","compare_url":"https://api.github.com/repos/rhcarvalho/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhcarvalho/origin/merges","archive_url":"https://api.github.com/repos/rhcarvalho/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhcarvalho/origin/downloads","issues_url":"https://api.github.com/repos/rhcarvalho/origin/issues{/number}","pulls_url":"https://api.github.com/repos/rhcarvalho/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/rhcarvalho/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/rhcarvalho/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhcarvalho/origin/labels{/name}","releases_url":"https://api.github.com/repos/rhcarvalho/origin/releases{/id}","deployments_url":"https://api.github.com/repos/rhcarvalho/origin/deployments","created_at":"2015-02-14T11:22:53Z","updated_at":"2016-01-13T10:20:06Z","pushed_at":"2016-02-05T15:00:48Z","git_url":"git://github.com/rhcarvalho/origin.git","ssh_url":"git@github.com:rhcarvalho/origin.git","clone_url":"https://github.com/rhcarvalho/origin.git","svn_url":"https://github.com/rhcarvalho/origin","homepage":"https://openshift.github.io","size":195853,"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":"d7b3f5131177c1ff8bb6ae558fabadd5c91ddfaf","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}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2016-02-05T02:49:38Z","pushed_at":"2016-02-05T15:00:49Z","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":248172,"stargazers_count":967,"watchers_count":967,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":617,"mirror_url":null,"open_issues_count":800,"forks":617,"open_issues":800,"watchers":967,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/6715"},"html":{"href":"https://github.com/openshift/origin/pull/6715"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/6715"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/6715/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/6715/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/6715/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/9a737499da8b1e885d5c5247762277f91911e3ed"}}}}