{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments/99684223","pull_request_review_id":20368610,"id":99684223,"diff_hunk":"@@ -92,7 +92,9 @@ def group_name\n \n     def run_kubectl(*args)\n       raise FatalDeploymentError, \"Namespace missing for namespaced command\" if namespace.blank?\n-      args = args.unshift(\"kubectl\").push(\"--namespace=#{namespace}\")\n+      raise FatalDeploymentError, \"Explicit context is required to run this command\" if context.blank?\n+      args = args.unshift(\"kubectl\").push(\"--namespace=#{namespace}\").push(\"--context=#{context}\")","path":"lib/kubernetes-deploy/kubernetes_resource.rb","position":46,"original_position":46,"commit_id":"efa596dfb0e8346be5a55ad236a5e051eea955e3","original_commit_id":"efa596dfb0e8346be5a55ad236a5e051eea955e3","user":{"login":"KnVerey","id":4789493,"avatar_url":"https://avatars.githubusercontent.com/u/4789493?v=3","gravatar_id":"","url":"https://api.github.com/users/KnVerey","html_url":"https://github.com/KnVerey","followers_url":"https://api.github.com/users/KnVerey/followers","following_url":"https://api.github.com/users/KnVerey/following{/other_user}","gists_url":"https://api.github.com/users/KnVerey/gists{/gist_id}","starred_url":"https://api.github.com/users/KnVerey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KnVerey/subscriptions","organizations_url":"https://api.github.com/users/KnVerey/orgs","repos_url":"https://api.github.com/users/KnVerey/repos","events_url":"https://api.github.com/users/KnVerey/events{/privacy}","received_events_url":"https://api.github.com/users/KnVerey/received_events","type":"User","site_admin":false},"body":"In general I agree with you that mutation should be avoided. In this case, however, given the purpose of this array, I'm having trouble imagining a scenario where getting the command that actually ran instead of the command passed in would be a bad thing. If, for example, you're trying to log it, it would actually be more accurate.","created_at":"2017-02-06T21:07:23Z","updated_at":"2017-02-06T21:07:23Z","html_url":"https://github.com/Shopify/kubernetes-deploy/pull/17#discussion_r99684223","pull_request_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments/99684223"},"html":{"href":"https://github.com/Shopify/kubernetes-deploy/pull/17#discussion_r99684223"},"pull_request":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17","id":104615674,"html_url":"https://github.com/Shopify/kubernetes-deploy/pull/17","diff_url":"https://github.com/Shopify/kubernetes-deploy/pull/17.diff","patch_url":"https://github.com/Shopify/kubernetes-deploy/pull/17.patch","issue_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/17","number":17,"state":"open","locked":false,"title":"Context flag for KubernetesResource#run_kubectl","user":{"login":"KnVerey","id":4789493,"avatar_url":"https://avatars.githubusercontent.com/u/4789493?v=3","gravatar_id":"","url":"https://api.github.com/users/KnVerey","html_url":"https://github.com/KnVerey","followers_url":"https://api.github.com/users/KnVerey/followers","following_url":"https://api.github.com/users/KnVerey/following{/other_user}","gists_url":"https://api.github.com/users/KnVerey/gists{/gist_id}","starred_url":"https://api.github.com/users/KnVerey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KnVerey/subscriptions","organizations_url":"https://api.github.com/users/KnVerey/orgs","repos_url":"https://api.github.com/users/KnVerey/repos","events_url":"https://api.github.com/users/KnVerey/events{/privacy}","received_events_url":"https://api.github.com/users/KnVerey/received_events","type":"User","site_admin":false},"body":"@kirs @sirupsen @mkobetic this is the minimum change need to fix the problem described in https://github.com/Shopify/shipit/pull/141. Another option is to make the runner's version a utility method available to both the runner instance and the resource instances, although that wouldn't get around passing the namespace/context everywhere (suggestions on that welcome). Some background:\r\n- The original reason for having two different versions is a difference in error handling and logging. The runner version handles critical deploy commands that could fail, and both its callers and the end user should be interested in error output as a result. The resources on the other hand are doing polling, in which context typical `!st.success?` causes are transient or even expected, e.g. 404s on a GETs for resources that aren't up yet.\r\n- As Kir suggested in another issue, the resource instances' version should likely be replaced with using the API via a gem rather than shelling out to kubectl.\r\n\r\nI've done a quick 🎩  already, but will also do the following on the final version after review:\r\n- [x] context missing\r\n- [x] context provided does not match current-context in kubeconfig\r\n- [x] at least one success and one error deploy with the `trashbin` set of files","created_at":"2017-02-03T21:33:07Z","updated_at":"2017-02-06T21:07:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6d3141b17ae1032aac9f9aca50d133f38910672f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17/commits","review_comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17/comments","review_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/17/comments","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/efa596dfb0e8346be5a55ad236a5e051eea955e3","head":{"label":"Shopify:resource_context","ref":"resource_context","sha":"efa596dfb0e8346be5a55ad236a5e051eea955e3","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":79269805,"name":"kubernetes-deploy","full_name":"Shopify/kubernetes-deploy","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/kubernetes-deploy","description":"Collection of scripts to deploy apps to Kubernetes","fork":false,"url":"https://api.github.com/repos/Shopify/kubernetes-deploy","forks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/forks","keys_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/teams","hooks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/hooks","issue_events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/events","assignees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/tags","blobs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/languages","stargazers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/stargazers","contributors_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contributors","subscribers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscribers","subscription_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscription","commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/merges","archive_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/downloads","issues_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/deployments","created_at":"2017-01-17T20:41:23Z","updated_at":"2017-01-31T05:27:02Z","pushed_at":"2017-02-03T22:31:24Z","git_url":"git://github.com/Shopify/kubernetes-deploy.git","ssh_url":"git@github.com:Shopify/kubernetes-deploy.git","clone_url":"https://github.com/Shopify/kubernetes-deploy.git","svn_url":"https://github.com/Shopify/kubernetes-deploy","homepage":"","size":89,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"530f9690b50615d869790f54c34074c990a1feb9","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":79269805,"name":"kubernetes-deploy","full_name":"Shopify/kubernetes-deploy","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/kubernetes-deploy","description":"Collection of scripts to deploy apps to Kubernetes","fork":false,"url":"https://api.github.com/repos/Shopify/kubernetes-deploy","forks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/forks","keys_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/teams","hooks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/hooks","issue_events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/events","assignees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/tags","blobs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/languages","stargazers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/stargazers","contributors_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contributors","subscribers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscribers","subscription_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscription","commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/merges","archive_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/downloads","issues_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/deployments","created_at":"2017-01-17T20:41:23Z","updated_at":"2017-01-31T05:27:02Z","pushed_at":"2017-02-03T22:31:24Z","git_url":"git://github.com/Shopify/kubernetes-deploy.git","ssh_url":"git@github.com:Shopify/kubernetes-deploy.git","clone_url":"https://github.com/Shopify/kubernetes-deploy.git","svn_url":"https://github.com/Shopify/kubernetes-deploy","homepage":"","size":89,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17"},"html":{"href":"https://github.com/Shopify/kubernetes-deploy/pull/17"},"issue":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/17"},"comments":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/efa596dfb0e8346be5a55ad236a5e051eea955e3"}}}}
{"actor":{"display_login":"KnVerey"}}