{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/comments/87895388","pull_request_review_id":8486572,"id":87895388,"diff_hunk":"@@ -0,0 +1,147 @@\n+#!/usr/bin/env ruby\n+\n+# Usage: deploy-to-gke <app's namespace> <gcloud deployment> <gcloud project>\n+\n+# Requires the following to be available on Shipit machine:\n+#  - gcloud binary available on the shipit machine's path\n+#  - kubectl binary available in the shipit machine's path\n+#  - $GCLOUD_CREDENTIALS_DIR/my-gcloud-project-name.json must exist\n+\n+# Optionally, the following variables can be used to override script defaults:\n+#  - K8S_TEMPLATE_FOLDER: location of Kubernetes files to deploy. Default is config/<environment>/.\n+\n+require 'open3'\n+require 'securerandom'\n+require 'erb'\n+require 'json'\n+require 'yaml'\n+require 'shellwords'\n+require 'tempfile'\n+\n+class GKEDeployment\n+  class FatalDeploymentError < StandardError; end\n+\n+  def initialize(namespace:, gcloud_deployment:, gcloud_project:, environment:, current_sha:, template_folder: nil)\n+    @namespace = namespace\n+    @gcloud_deployment = gcloud_deployment\n+    @gcloud_project = gcloud_project\n+    @current_sha = current_sha\n+    enforce_required_parmas\n+    @id = current_sha + \"-#{SecureRandom.hex(4)}\"","path":"lib/snippets/deploy-to-gke","position":30,"original_position":30,"commit_id":"adf9dbd4f01e466bbb05c72afd537d3bc643443b","original_commit_id":"adf9dbd4f01e466bbb05c72afd537d3bc643443b","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":"I think we should truncate the sha here. This is going to be appended to pod names to make them unique per deploy, and the max length of a pod name is 63 characters. This would only leave 15 characters for the real pod name. Could be needlessly annoying for our end users.","created_at":"2016-11-14T21:23:00Z","updated_at":"2016-11-14T21:44:27Z","html_url":"https://github.com/Shopify/shipit-engine/pull/616#discussion_r87895388","pull_request_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616","_links":{"self":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/comments/87895388"},"html":{"href":"https://github.com/Shopify/shipit-engine/pull/616#discussion_r87895388"},"pull_request":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616","id":93162426,"html_url":"https://github.com/Shopify/shipit-engine/pull/616","diff_url":"https://github.com/Shopify/shipit-engine/pull/616.diff","patch_url":"https://github.com/Shopify/shipit-engine/pull/616.patch","issue_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/616","number":616,"state":"open","locked":false,"title":"Deploy to gke ","user":{"login":"n1koo","id":1556937,"avatar_url":"https://avatars.githubusercontent.com/u/1556937?v=3","gravatar_id":"","url":"https://api.github.com/users/n1koo","html_url":"https://github.com/n1koo","followers_url":"https://api.github.com/users/n1koo/followers","following_url":"https://api.github.com/users/n1koo/following{/other_user}","gists_url":"https://api.github.com/users/n1koo/gists{/gist_id}","starred_url":"https://api.github.com/users/n1koo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1koo/subscriptions","organizations_url":"https://api.github.com/users/n1koo/orgs","repos_url":"https://api.github.com/users/n1koo/repos","events_url":"https://api.github.com/users/n1koo/events{/privacy}","received_events_url":"https://api.github.com/users/n1koo/received_events","type":"User","site_admin":false},"body":"**What** \r\n\r\nThis is a similar util as https://github.com/Shopify/shipit-engine/blob/master/lib/snippets/push-to-heroku but for deploying to `gke`.\r\n\r\n`Usage: deploy-to-gke <app's namespace> <gcloud deployment> <gcloud project>` to match up the correct destination\r\n\r\nWe assume the repo has the configs in `config/kubernetes/#{environment}/` or overwrites the templatepath via `K8S_TEMPLATE_FOLDER`. \r\n\r\nFor testing something like \r\n\r\n```ENVIRONMENT=environment K8S_TEMPLATE_FOLDER=/tmp/template REVISION=deadcode ./deploy-to-gke.rb foobar test-cluster shopify-tiers``` can be used\r\n\r\n**Notes/TODO etc.** \r\n\r\nThis is still a bit raw, but it works (:tophat:). We are in a somewhat hurry to get this out so i'd appreciate reviews and please nitpick on all the things. I'll be raging through them on monday morning.\r\n\r\n@KnVerey  @byroot ","created_at":"2016-11-10T14:40:42Z","updated_at":"2016-11-14T21:44:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28e1bbc3df043969f82cf3c193d0478dfa92283e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616/commits","review_comments_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616/comments","review_comment_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/616/comments","statuses_url":"https://api.github.com/repos/Shopify/shipit-engine/statuses/adf9dbd4f01e466bbb05c72afd537d3bc643443b","head":{"label":"Shopify:deploy_to_gke","ref":"deploy_to_gke","sha":"adf9dbd4f01e466bbb05c72afd537d3bc643443b","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":17228890,"name":"shipit-engine","full_name":"Shopify/shipit-engine","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/shipit-engine","description":"Deployment coordination","fork":false,"url":"https://api.github.com/repos/Shopify/shipit-engine","forks_url":"https://api.github.com/repos/Shopify/shipit-engine/forks","keys_url":"https://api.github.com/repos/Shopify/shipit-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/shipit-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/shipit-engine/teams","hooks_url":"https://api.github.com/repos/Shopify/shipit-engine/hooks","issue_events_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/shipit-engine/events","assignees_url":"https://api.github.com/repos/Shopify/shipit-engine/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/shipit-engine/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/shipit-engine/tags","blobs_url":"https://api.github.com/repos/Shopify/shipit-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/shipit-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/shipit-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/shipit-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/shipit-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/shipit-engine/languages","stargazers_url":"https://api.github.com/repos/Shopify/shipit-engine/stargazers","contributors_url":"https://api.github.com/repos/Shopify/shipit-engine/contributors","subscribers_url":"https://api.github.com/repos/Shopify/shipit-engine/subscribers","subscription_url":"https://api.github.com/repos/Shopify/shipit-engine/subscription","commits_url":"https://api.github.com/repos/Shopify/shipit-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/shipit-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/shipit-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/shipit-engine/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/shipit-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/shipit-engine/merges","archive_url":"https://api.github.com/repos/Shopify/shipit-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/shipit-engine/downloads","issues_url":"https://api.github.com/repos/Shopify/shipit-engine/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/shipit-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/shipit-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/shipit-engine/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/shipit-engine/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/shipit-engine/deployments","created_at":"2014-02-26T22:59:57Z","updated_at":"2016-11-09T22:14:48Z","pushed_at":"2016-11-14T15:46:48Z","git_url":"git://github.com/Shopify/shipit-engine.git","ssh_url":"git@github.com:Shopify/shipit-engine.git","clone_url":"https://github.com/Shopify/shipit-engine.git","svn_url":"https://github.com/Shopify/shipit-engine","homepage":"https://www.shopify.com/technology/34281221-introducing-shipit","size":2325,"stargazers_count":468,"watchers_count":468,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":35,"forks":33,"open_issues":35,"watchers":468,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"d018142ebaa24d0fbbe52add593fcdac21d1bf5e","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":17228890,"name":"shipit-engine","full_name":"Shopify/shipit-engine","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/shipit-engine","description":"Deployment coordination","fork":false,"url":"https://api.github.com/repos/Shopify/shipit-engine","forks_url":"https://api.github.com/repos/Shopify/shipit-engine/forks","keys_url":"https://api.github.com/repos/Shopify/shipit-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/shipit-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/shipit-engine/teams","hooks_url":"https://api.github.com/repos/Shopify/shipit-engine/hooks","issue_events_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/shipit-engine/events","assignees_url":"https://api.github.com/repos/Shopify/shipit-engine/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/shipit-engine/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/shipit-engine/tags","blobs_url":"https://api.github.com/repos/Shopify/shipit-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/shipit-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/shipit-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/shipit-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/shipit-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/shipit-engine/languages","stargazers_url":"https://api.github.com/repos/Shopify/shipit-engine/stargazers","contributors_url":"https://api.github.com/repos/Shopify/shipit-engine/contributors","subscribers_url":"https://api.github.com/repos/Shopify/shipit-engine/subscribers","subscription_url":"https://api.github.com/repos/Shopify/shipit-engine/subscription","commits_url":"https://api.github.com/repos/Shopify/shipit-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/shipit-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/shipit-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/shipit-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/shipit-engine/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/shipit-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/shipit-engine/merges","archive_url":"https://api.github.com/repos/Shopify/shipit-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/shipit-engine/downloads","issues_url":"https://api.github.com/repos/Shopify/shipit-engine/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/shipit-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/shipit-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/shipit-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/shipit-engine/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/shipit-engine/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/shipit-engine/deployments","created_at":"2014-02-26T22:59:57Z","updated_at":"2016-11-09T22:14:48Z","pushed_at":"2016-11-14T15:46:48Z","git_url":"git://github.com/Shopify/shipit-engine.git","ssh_url":"git@github.com:Shopify/shipit-engine.git","clone_url":"https://github.com/Shopify/shipit-engine.git","svn_url":"https://github.com/Shopify/shipit-engine","homepage":"https://www.shopify.com/technology/34281221-introducing-shipit","size":2325,"stargazers_count":468,"watchers_count":468,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":35,"forks":33,"open_issues":35,"watchers":468,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616"},"html":{"href":"https://github.com/Shopify/shipit-engine/pull/616"},"issue":{"href":"https://api.github.com/repos/Shopify/shipit-engine/issues/616"},"comments":{"href":"https://api.github.com/repos/Shopify/shipit-engine/issues/616/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/shipit-engine/pulls/616/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/shipit-engine/statuses/adf9dbd4f01e466bbb05c72afd537d3bc643443b"}}}}
{"actor":{"display_login":"KnVerey"}}