{"action":"created","comment":{"url":"https://api.github.com/repos/azavea/raster-foundry/pulls/comments/76418537","id":76418537,"diff_hunk":"@@ -0,0 +1,134 @@\n+#!/bin/bash\n+set -e\n+\n+DIR=\"$(dirname \"$0\")\"\n+\n+if [[ -n \"${RF_DEBUG}\" ]]; then\n+    set -x\n+fi\n+\n+function usage() {\n+    echo -n \\\n+         \"Usage: $(basename \"$0\")\n+Build application for staging or a release.\n+\"\n+}\n+\n+function check_database() {\n+    # Check if database is set up to continue\n+\n+    max=21 # 1 minute\n+    counter=1\n+    while true\n+    do\n+        echo \"Checking if database is up yet (try ${counter})...\"\n+        set +e\n+        docker-compose -f \"${DIR}/../docker-compose.yml\" exec -T postgres gosu postgres psql -d rasterfoundry -c 'select 1' >/dev/null 2>/dev/null\n+        status_check=$?\n+        if [ $status_check == 0 ]\n+        then\n+            echo \"Connected to database successfully\"\n+            break\n+        fi\n+        set -e\n+        if [[ ${counter} == \"${max}\" ]]\n+        then\n+            echo \"Could not connect to database after some time\"\n+            exit 1\n+        fi\n+        sleep 3\n+        (( counter++ ))\n+    done\n+}\n+\n+\n+function create_airflow_database() {\n+    docker-compose -f \"${DIR}/../docker-compose.yml\" up -d postgres\n+    check_database\n+    set +e\n+    # Create database (have to ignore errors if database already exists)\n+    docker-compose -f \"${DIR}/../docker-compose.yml\" \\\n+        exec -T postgres gosu postgres createdb airflow >/dev/null 2>/dev/null\n+    set -e\n+    GIT_COMMIT=${GIT_COMMIT} docker-compose \\\n+        -f \"${DIR}/../docker-compose.yml\" \\\n+        run --rm airflow-webserver airflow initdb\n+\n+    docker-compose -f \"${DIR}/../docker-compose.yml\" stop postgres\n+}\n+\n+function setup() {\n+\n+    # Pull additional services\n+    docker-compose \\\n+        -f \"${DIR}/../docker-compose.yml\" \\\n+        pull nginx postgres swagger-editor redis\n+\n+    create_airflow_database\n+\n+    # app-server updates\n+    docker-compose \\\n+        -f \"${DIR}/../docker-compose.yml\" \\\n+        run --rm app-server sbt update\n+\n+    # app-frontend updates\n+    docker-compose \\\n+        -f \"${DIR}/../docker-compose.yml\" \\\n+        run --rm app-frontend npm install --quiet\n+\n+    docker-compose \\\n+        -f \"${DIR}/../docker-compose.yml\" \\\n+        run --rm app-frontend npm run build\n+}\n+\n+\n+if [[ -n \"${GIT_COMMIT}\" ]]; then\n+    GIT_COMMIT=\"${GIT_COMMIT:0:7}\"\n+else\n+    GIT_COMMIT=\"$(git rev-parse --short HEAD)\"\n+fi\n+\n+if [ \"${BASH_SOURCE[0]}\" = \"${0}\" ]; then\n+    if [ \"${1:-}\" = \"--help\" ]; then\n+        usage\n+    else\n+        echo \"Pulling down testing environment...\"\n+        pushd \"${DIR}/..\"\n+        # Download environment configuration from S3\n+        aws s3 cp \"s3://rasterfoundry-testing-config-us-east-1/.env\" \".env\"\n+        popd    \n+\n+        # Build/pull containers\n+        echo \"Building/Pulling containers...\"\n+        setup\n+\n+        ./scripts/test\n+\n+        # Clean up containers after testing\n+        echo \"Cleaning up containers...\"\n+        docker-compose stop\n+        docker-compose rm -f --all\n+\n+        # Build JAR file\n+        echo \"Building JAR file...\"\n+        GIT_COMMIT=${GIT_COMMIT} docker-compose \\\n+            run --no-deps --rm --entrypoint ./sbt app-server app/assembly\n+        \n+        # Build app, airflow\n+        echo \"Building app, airflow...\"\n+        GIT_COMMIT=${GIT_COMMIT} docker-compose \\\n+            -f \"${DIR}/../docker-compose.yml\" \\\n+            -f \"${DIR}/../docker-compose.test.yml\"\\\n+            build\n+\n+\n+        # If the cibuild.d directory exists, source each script it","path":"scripts/cibuild.sh","position":125,"original_position":125,"commit_id":"a99a907f3d65b7f3c52c9c4cec8bf264da8377e4","original_commit_id":"a99a907f3d65b7f3c52c9c4cec8bf264da8377e4","user":{"login":"hectcastro","id":43639,"avatar_url":"https://avatars.githubusercontent.com/u/43639?v=3","gravatar_id":"","url":"https://api.github.com/users/hectcastro","html_url":"https://github.com/hectcastro","followers_url":"https://api.github.com/users/hectcastro/followers","following_url":"https://api.github.com/users/hectcastro/following{/other_user}","gists_url":"https://api.github.com/users/hectcastro/gists{/gist_id}","starred_url":"https://api.github.com/users/hectcastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hectcastro/subscriptions","organizations_url":"https://api.github.com/users/hectcastro/orgs","repos_url":"https://api.github.com/users/hectcastro/repos","events_url":"https://api.github.com/users/hectcastro/events{/privacy}","received_events_url":"https://api.github.com/users/hectcastro/received_events","type":"User","site_admin":false},"body":"I don't think this functionality needs to be brought in here until we have a reason to hook into it.","created_at":"2016-08-26T13:33:06Z","updated_at":"2016-08-26T13:33:06Z","html_url":"https://github.com/azavea/raster-foundry/pull/431#discussion_r76418537","pull_request_url":"https://api.github.com/repos/azavea/raster-foundry/pulls/431","_links":{"self":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/comments/76418537"},"html":{"href":"https://github.com/azavea/raster-foundry/pull/431#discussion_r76418537"},"pull_request":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/431"}}},"pull_request":{"url":"https://api.github.com/repos/azavea/raster-foundry/pulls/431","id":82763226,"html_url":"https://github.com/azavea/raster-foundry/pull/431","diff_url":"https://github.com/azavea/raster-foundry/pull/431.diff","patch_url":"https://github.com/azavea/raster-foundry/pull/431.patch","issue_url":"https://api.github.com/repos/azavea/raster-foundry/issues/431","number":431,"state":"open","locked":false,"title":"WIP: Create Jenkins Pipeline Part 1 - CIBuild","user":{"login":"tnation14","id":2507188,"avatar_url":"https://avatars.githubusercontent.com/u/2507188?v=3","gravatar_id":"","url":"https://api.github.com/users/tnation14","html_url":"https://github.com/tnation14","followers_url":"https://api.github.com/users/tnation14/followers","following_url":"https://api.github.com/users/tnation14/following{/other_user}","gists_url":"https://api.github.com/users/tnation14/gists{/gist_id}","starred_url":"https://api.github.com/users/tnation14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tnation14/subscriptions","organizations_url":"https://api.github.com/users/tnation14/orgs","repos_url":"https://api.github.com/users/tnation14/repos","events_url":"https://api.github.com/users/tnation14/events{/privacy}","received_events_url":"https://api.github.com/users/tnation14/received_events","type":"User","site_admin":false},"body":"Create a `Jenkinsfile` that uses a `cibuild.sh` script to automatically build docker images. \r\n\r\n## Testing\r\n\r\nEnsure that this job runs fully, and that `docker images` lists `raster-foundry-{service}:{GIT_COMMIT}` images, tagged with a git commit SHA.\r\n\r\n<pre><code>\r\n$ docker images\r\nREPOSITORY                  TAG                      IMAGE ID            CREATED             SIZE\r\n<b>raster-foundry-nginx        2f49953</b>                  0703301d0ac0        35 minutes ago      206.9 MB\r\n<b>raster-foundry-app-server   2f49953</b>                  2db426d400b4        35 minutes ago      142.6 MB\r\n<b>raster-foundry-airflow      2f49953</b>                  c951d062a8ac        35 minutes ago      946.7 MB\r\n</code></pre>","created_at":"2016-08-25T17:47:33Z","updated_at":"2016-08-26T13:33:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ebe1ca4cb223a3d7da0509d80563f551f197b1a","assignee":{"login":"hectcastro","id":43639,"avatar_url":"https://avatars.githubusercontent.com/u/43639?v=3","gravatar_id":"","url":"https://api.github.com/users/hectcastro","html_url":"https://github.com/hectcastro","followers_url":"https://api.github.com/users/hectcastro/followers","following_url":"https://api.github.com/users/hectcastro/following{/other_user}","gists_url":"https://api.github.com/users/hectcastro/gists{/gist_id}","starred_url":"https://api.github.com/users/hectcastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hectcastro/subscriptions","organizations_url":"https://api.github.com/users/hectcastro/orgs","repos_url":"https://api.github.com/users/hectcastro/repos","events_url":"https://api.github.com/users/hectcastro/events{/privacy}","received_events_url":"https://api.github.com/users/hectcastro/received_events","type":"User","site_admin":false},"assignees":[{"login":"hectcastro","id":43639,"avatar_url":"https://avatars.githubusercontent.com/u/43639?v=3","gravatar_id":"","url":"https://api.github.com/users/hectcastro","html_url":"https://github.com/hectcastro","followers_url":"https://api.github.com/users/hectcastro/followers","following_url":"https://api.github.com/users/hectcastro/following{/other_user}","gists_url":"https://api.github.com/users/hectcastro/gists{/gist_id}","starred_url":"https://api.github.com/users/hectcastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hectcastro/subscriptions","organizations_url":"https://api.github.com/users/hectcastro/orgs","repos_url":"https://api.github.com/users/hectcastro/repos","events_url":"https://api.github.com/users/hectcastro/events{/privacy}","received_events_url":"https://api.github.com/users/hectcastro/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/azavea/raster-foundry/pulls/431/commits","review_comments_url":"https://api.github.com/repos/azavea/raster-foundry/pulls/431/comments","review_comment_url":"https://api.github.com/repos/azavea/raster-foundry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/azavea/raster-foundry/issues/431/comments","statuses_url":"https://api.github.com/repos/azavea/raster-foundry/statuses/a99a907f3d65b7f3c52c9c4cec8bf264da8377e4","head":{"label":"azavea:feature/jenkins-pipeline","ref":"feature/jenkins-pipeline","sha":"a99a907f3d65b7f3c52c9c4cec8bf264da8377e4","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":36464140,"name":"raster-foundry","full_name":"azavea/raster-foundry","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/raster-foundry","description":"The Raster Foundry web application.","fork":false,"url":"https://api.github.com/repos/azavea/raster-foundry","forks_url":"https://api.github.com/repos/azavea/raster-foundry/forks","keys_url":"https://api.github.com/repos/azavea/raster-foundry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/raster-foundry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/raster-foundry/teams","hooks_url":"https://api.github.com/repos/azavea/raster-foundry/hooks","issue_events_url":"https://api.github.com/repos/azavea/raster-foundry/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/raster-foundry/events","assignees_url":"https://api.github.com/repos/azavea/raster-foundry/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/raster-foundry/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/raster-foundry/tags","blobs_url":"https://api.github.com/repos/azavea/raster-foundry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/raster-foundry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/raster-foundry/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/raster-foundry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/raster-foundry/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/raster-foundry/languages","stargazers_url":"https://api.github.com/repos/azavea/raster-foundry/stargazers","contributors_url":"https://api.github.com/repos/azavea/raster-foundry/contributors","subscribers_url":"https://api.github.com/repos/azavea/raster-foundry/subscribers","subscription_url":"https://api.github.com/repos/azavea/raster-foundry/subscription","commits_url":"https://api.github.com/repos/azavea/raster-foundry/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/raster-foundry/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/raster-foundry/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/raster-foundry/issues/comments{/number}","contents_url":"https://api.github.com/repos/azavea/raster-foundry/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/raster-foundry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/raster-foundry/merges","archive_url":"https://api.github.com/repos/azavea/raster-foundry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/raster-foundry/downloads","issues_url":"https://api.github.com/repos/azavea/raster-foundry/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/raster-foundry/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/raster-foundry/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/raster-foundry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/raster-foundry/labels{/name}","releases_url":"https://api.github.com/repos/azavea/raster-foundry/releases{/id}","deployments_url":"https://api.github.com/repos/azavea/raster-foundry/deployments","created_at":"2015-05-28T20:25:45Z","updated_at":"2016-07-18T16:12:22Z","pushed_at":"2016-08-25T20:08:58Z","git_url":"git://github.com/azavea/raster-foundry.git","ssh_url":"git@github.com:azavea/raster-foundry.git","clone_url":"https://github.com/azavea/raster-foundry.git","svn_url":"https://github.com/azavea/raster-foundry","homepage":"","size":13540,"stargazers_count":5,"watchers_count":5,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":28,"forks":8,"open_issues":28,"watchers":5,"default_branch":"develop"}},"base":{"label":"azavea:develop","ref":"develop","sha":"ae3b5dfdf494aa4ca58967f4e0fb894353a719da","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":36464140,"name":"raster-foundry","full_name":"azavea/raster-foundry","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/raster-foundry","description":"The Raster Foundry web application.","fork":false,"url":"https://api.github.com/repos/azavea/raster-foundry","forks_url":"https://api.github.com/repos/azavea/raster-foundry/forks","keys_url":"https://api.github.com/repos/azavea/raster-foundry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/raster-foundry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/raster-foundry/teams","hooks_url":"https://api.github.com/repos/azavea/raster-foundry/hooks","issue_events_url":"https://api.github.com/repos/azavea/raster-foundry/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/raster-foundry/events","assignees_url":"https://api.github.com/repos/azavea/raster-foundry/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/raster-foundry/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/raster-foundry/tags","blobs_url":"https://api.github.com/repos/azavea/raster-foundry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/raster-foundry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/raster-foundry/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/raster-foundry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/raster-foundry/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/raster-foundry/languages","stargazers_url":"https://api.github.com/repos/azavea/raster-foundry/stargazers","contributors_url":"https://api.github.com/repos/azavea/raster-foundry/contributors","subscribers_url":"https://api.github.com/repos/azavea/raster-foundry/subscribers","subscription_url":"https://api.github.com/repos/azavea/raster-foundry/subscription","commits_url":"https://api.github.com/repos/azavea/raster-foundry/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/raster-foundry/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/raster-foundry/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/raster-foundry/issues/comments{/number}","contents_url":"https://api.github.com/repos/azavea/raster-foundry/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/raster-foundry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/raster-foundry/merges","archive_url":"https://api.github.com/repos/azavea/raster-foundry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/raster-foundry/downloads","issues_url":"https://api.github.com/repos/azavea/raster-foundry/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/raster-foundry/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/raster-foundry/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/raster-foundry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/raster-foundry/labels{/name}","releases_url":"https://api.github.com/repos/azavea/raster-foundry/releases{/id}","deployments_url":"https://api.github.com/repos/azavea/raster-foundry/deployments","created_at":"2015-05-28T20:25:45Z","updated_at":"2016-07-18T16:12:22Z","pushed_at":"2016-08-25T20:08:58Z","git_url":"git://github.com/azavea/raster-foundry.git","ssh_url":"git@github.com:azavea/raster-foundry.git","clone_url":"https://github.com/azavea/raster-foundry.git","svn_url":"https://github.com/azavea/raster-foundry","homepage":"","size":13540,"stargazers_count":5,"watchers_count":5,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":28,"forks":8,"open_issues":28,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/431"},"html":{"href":"https://github.com/azavea/raster-foundry/pull/431"},"issue":{"href":"https://api.github.com/repos/azavea/raster-foundry/issues/431"},"comments":{"href":"https://api.github.com/repos/azavea/raster-foundry/issues/431/comments"},"review_comments":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/431/comments"},"review_comment":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/azavea/raster-foundry/pulls/431/commits"},"statuses":{"href":"https://api.github.com/repos/azavea/raster-foundry/statuses/a99a907f3d65b7f3c52c9c4cec8bf264da8377e4"}}}}
{"actor":{"display_login":"hectcastro"}}