{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments/44970487","id":44970487,"diff_hunk":"@@ -0,0 +1,135 @@\n+#!/bin/bash\n+#\n+# This script runs the sql logic test on AWS.\n+#\n+# If run as a cron job, make sure you set your basic environment variables.\n+# Run with:\n+# run_logictests.sh [log dir]\n+#\n+# Logs will be saved in [log dir]/date-time/[instance number]/\n+#\n+# Requirements for this to work:\n+# * basic environment variables set: HOME, PATH, GOPATH\n+# * ~/.aws/credentials with valid AWS credentials\n+# * ~/.ssh/cockroach.pem downloaded from AWS.\n+# * terraform installed in your PATH\n+# * <COCKROACH_BASE>/sqllogictest repo cloned and up to date\n+# * <COCKROACH_BASE>/cockroach-prod repo cloned and up to date\n+#\n+# This script retries various operations quite a bit, but without\n+# a limit on the number of retries. This may cause issues.\n+#\n+# A sample crontab (to be filled-in) to run this nightly would be:\n+# MAILTO=myaddress@myprovider.com\n+# USER=MYUSER\n+# HOME=/home/MYUSER\n+# PATH=/bin:/sbin:/usr/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/home/MYUSER/bin:/home/MYUSER/go/bin\n+# GOPATH=/home/MYUSER/cockroach\n+#\n+# 0 0 * * * /home/MYUSER/cockroach/src/github.com/cockroachdb/cockroach-prod/scripts/run_logictests.sh /MYLOGDIR/ &> /MYLOGDIR/LATEST\n+\n+set -ex\n+\n+COCKROACH_BASE=\"${GOPATH}/src/github.com/cockroachdb\"\n+SQLTEST_REPO=\"${COCKROACH_BASE}/sqllogictest\"\n+PROD_REPO=\"${COCKROACH_BASE}/cockroach-prod\"\n+LOGS_DIR=$1\n+SSH_KEY=~/.ssh/cockroach.pem\n+SSH_USER=\"ubuntu\"\n+\n+if [ -z \"${LOGS_DIR}\" ]; then\n+  echo \"No logs directory specified. Run with: $0 [logs dir]\"\n+  exit 1\n+fi\n+\n+if [ -z \"${SQLTEST_REPO}\" ]; then\n+  echo \"Could not find directory ${SQLTEST_REPO}\"\n+  exit 1\n+fi\n+\n+if [ -z \"${PROD_REPO}\" ]; then\n+  echo \"Could not find directory ${PROD_REPO}\"\n+  exit 1\n+fi\n+\n+which terraform > /dev/null\n+if [ $? -ne \"0\" ]; then\n+  echo \"Could not find terraform in your path\"\n+  exit 1\n+fi\n+\n+run_timestamp=$(date  +\"%Y%m%d-%H%M%S\")\n+cd ${PROD_REPO}/terraform/aws/tests\n+\n+# Start the instances and work.\n+# We loop to retry instances that take too long to setup (it seems to happen).\n+set +e\n+while true; do\n+  terraform apply\n+  if [ $? -eq \"0\" ]; then\n+    break\n+  fi\n+  echo \"Terraform apply failed. Retrying in 3 seconds.\"\n+  sleep 3\n+done\n+set -e\n+\n+# Fetch instances names.\n+instances=$(terraform output instance|cut -d'=' -f2|tr ',' ' ')\n+\n+# Wait for jobs to complete.\n+hasall=0\n+while [ ${hasall} -eq 0 ];\n+do\n+  sleep 10\n+  hasall=1\n+  for i in ${instances}; do\n+    set +e\n+    ssh -i ${SSH_KEY} -oStrictHostKeyChecking=no ${SSH_USER}@${i} stat logs/DONE \\> /dev/null 2\\>\\&1","path":"scripts/run_logictests.sh","position":88,"original_position":88,"commit_id":"66ac995fa0fd34f004c47c1f50079f1ba63138a8","original_commit_id":"66ac995fa0fd34f004c47c1f50079f1ba63138a8","user":{"login":"mberhault","id":5901480,"avatar_url":"https://avatars.githubusercontent.com/u/5901480?v=3","gravatar_id":"","url":"https://api.github.com/users/mberhault","html_url":"https://github.com/mberhault","followers_url":"https://api.github.com/users/mberhault/followers","following_url":"https://api.github.com/users/mberhault/following{/other_user}","gists_url":"https://api.github.com/users/mberhault/gists{/gist_id}","starred_url":"https://api.github.com/users/mberhault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mberhault/subscriptions","organizations_url":"https://api.github.com/users/mberhault/orgs","repos_url":"https://api.github.com/users/mberhault/repos","events_url":"https://api.github.com/users/mberhault/events{/privacy}","received_events_url":"https://api.github.com/users/mberhault/received_events","type":"User","site_admin":false},"body":"uh? you probably mean `||`. how would it help? I specifically do not want to exit the script in this command, I want its status instead.","created_at":"2015-11-16T19:33:00Z","updated_at":"2015-11-16T19:33:00Z","html_url":"https://github.com/cockroachdb/cockroach-prod/pull/43#discussion_r44970487","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments/44970487"},"html":{"href":"https://github.com/cockroachdb/cockroach-prod/pull/43#discussion_r44970487"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43","id":50837449,"html_url":"https://github.com/cockroachdb/cockroach-prod/pull/43","diff_url":"https://github.com/cockroachdb/cockroach-prod/pull/43.diff","patch_url":"https://github.com/cockroachdb/cockroach-prod/pull/43.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/43","number":43,"state":"open","locked":false,"title":"Add logictest runner","user":{"login":"mberhault","id":5901480,"avatar_url":"https://avatars.githubusercontent.com/u/5901480?v=3","gravatar_id":"","url":"https://api.github.com/users/mberhault","html_url":"https://github.com/mberhault","followers_url":"https://api.github.com/users/mberhault/followers","following_url":"https://api.github.com/users/mberhault/following{/other_user}","gists_url":"https://api.github.com/users/mberhault/gists{/gist_id}","starred_url":"https://api.github.com/users/mberhault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mberhault/subscriptions","organizations_url":"https://api.github.com/users/mberhault/orgs","repos_url":"https://api.github.com/users/mberhault/repos","events_url":"https://api.github.com/users/mberhault/events{/privacy}","received_events_url":"https://api.github.com/users/mberhault/received_events","type":"User","site_admin":false},"body":"Given a few prerequisites, the script runs the sql logic tests on AWS,\r\nfetches the logs, and sends a summary email.\r\nLogs for now are saved on local disk, with stdout from every instances\r\nattached to the email.\r\n\r\nI've added this to my crontab to run nightly and email\r\ndaily@cockroachlabs.com\r\n\r\nIf you can run \"terraform apply\" in cockroach-prod/terraform/aws/tests/, this should work for you.","created_at":"2015-11-16T17:07:10Z","updated_at":"2015-11-16T19:33:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37b0eb286224d6782103f837d7845ce1dd9db2e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/43/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/66ac995fa0fd34f004c47c1f50079f1ba63138a8","head":{"label":"cockroachdb:marc/logictest_script","ref":"marc/logictest_script","sha":"66ac995fa0fd34f004c47c1f50079f1ba63138a8","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":34730187,"name":"cockroach-prod","full_name":"cockroachdb/cockroach-prod","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach-prod","description":"Production tools for cockroachdb.","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach-prod","forks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/releases{/id}","created_at":"2015-04-28T12:51:48Z","updated_at":"2015-11-04T18:31:54Z","pushed_at":"2015-11-16T19:12:51Z","git_url":"git://github.com/cockroachdb/cockroach-prod.git","ssh_url":"git@github.com:cockroachdb/cockroach-prod.git","clone_url":"https://github.com/cockroachdb/cockroach-prod.git","svn_url":"https://github.com/cockroachdb/cockroach-prod","homepage":null,"size":185,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":23,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"a24082cc4f8e52d2fc06a4ee32e8d240e5b1d573","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":34730187,"name":"cockroach-prod","full_name":"cockroachdb/cockroach-prod","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach-prod","description":"Production tools for cockroachdb.","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach-prod","forks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/releases{/id}","created_at":"2015-04-28T12:51:48Z","updated_at":"2015-11-04T18:31:54Z","pushed_at":"2015-11-16T19:12:51Z","git_url":"git://github.com/cockroachdb/cockroach-prod.git","ssh_url":"git@github.com:cockroachdb/cockroach-prod.git","clone_url":"https://github.com/cockroachdb/cockroach-prod.git","svn_url":"https://github.com/cockroachdb/cockroach-prod","homepage":null,"size":185,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43"},"html":{"href":"https://github.com/cockroachdb/cockroach-prod/pull/43"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/43"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/66ac995fa0fd34f004c47c1f50079f1ba63138a8"}}}}