{"action":"created","comment":{"url":"https://api.github.com/repos/buildpack/samples/pulls/comments/213800794","pull_request_review_id":150713149,"id":213800794,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzgwMDc5NA==","diff_hunk":"@@ -17,36 +23,65 @@ fi\n \n echo \"---> Installing JDK\"\n \n-if [[ ! -f $launch_dir/jdk.toml ]]; then\n-  mkdir -p $launch_dir/jdk\n-  jdk_url=\"https://cdn.azul.com/zulu/bin/zulu8.28.0.1-jdk8.0.163-linux_x64.tar.gz\"\n-  curl -sfL \"$jdk_url\" | tar pxz -C $launch_dir/jdk --strip-components=1\n+# If it doesn't exist locally, create a JDK cache layer\n+# This makes JDK available to subsequent buildpacks as well.\n+if [[ -f $cache_dir/jdk.toml ]]; then\n+  cached_jdk_url=$(cat \"$cache_dir/jdk.toml\" | yj -t | jq -r .url 2>/dev/null || echo 'JDK TOML parsing failed')\n+fi\n+if [[ $jdk_url != $cached_jdk_url ]] ; then\n+  rm -rf \"$cache_dir\"/jdk\n+  mkdir -p \"$cache_dir\"/jdk/env\n+  curl -sfL \"$jdk_url\" | tar pxz -C \"$cache_dir\"/jdk --strip-components=1\n+  echo -e \"version = \\\"$jdk_version\\\"\\nurl = \\\"$jdk_url\\\"\" > \"$cache_dir\"/jdk.toml\n+\n+  echo \"$cache_dir\"/jdk > \"$cache_dir\"/jdk/env/JAVA_HOME\n+  if [[ -z $LD_LIBRARY_PATH ]]; then\n+    echo \"$JAVA_HOME/jre/lib/amd64/server\" > $cache_dir/jdk/env/LD_LIBRARY_PATH\n+  else\n+    echo \"$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH\" > $cache_dir/jdk/env/LD_LIBRARY_PATH\n+  fi\n+fi\n+# Set env variables to make jdk accessible\n+for var in \"$cache_dir\"/jdk/env/*; do\n+  declare \"$(basename \"$var\")=$(<\"$var\")\"\n+done\n+export PATH=$cache_dir/jdk/bin:$PATH\n+\n+# If it doesn't exist remotely, create a JDK launch layer\n+if [[ -f $launch_dir/jdk.toml ]]; then\n+  launch_jdk_url=$(cat \"$launch_dir/jdk.toml\" | yj -t | jq -r .url 2>/dev/null || echo 'JDK TOML parsing failed')\n+fi\n+if [[ $jdk_url != $launch_jdk_url ]] ; then\n+  cp -r \"$cache_dir\"/jdk \"$launch_dir\"\n+  cp \"$cache_dir\"/jdk.toml \"$launch_dir\"/jdk.toml\n+\n   mkdir -p $launch_dir/jdk/profile.d\n   cat << EOF > $launch_dir/jdk/profile.d/jdk.sh\n export JAVA_HOME=$launch_dir/jdk\n-export PATH=\\$JAVA_HOME/bin:\\$PATH\n-export LD_LIBRARY_PATH=\"\\$JAVA_HOME/jre/lib/amd64/server:\\$LD_LIBRARY_PATH\"\n+if [[ -z \\$LD_LIBRARY_PATH ]]; then","path":"java-buildpack/bin/build","position":58,"original_position":58,"commit_id":"f8e9213a64de8cf2fe854b2abc6b8a4acb43a1ec","original_commit_id":"f8e9213a64de8cf2fe854b2abc6b8a4acb43a1ec","user":{"login":"sclevine","id":1848837,"node_id":"MDQ6VXNlcjE4NDg4Mzc=","avatar_url":"https://avatars3.githubusercontent.com/u/1848837?v=4","gravatar_id":"","url":"https://api.github.com/users/sclevine","html_url":"https://github.com/sclevine","followers_url":"https://api.github.com/users/sclevine/followers","following_url":"https://api.github.com/users/sclevine/following{/other_user}","gists_url":"https://api.github.com/users/sclevine/gists{/gist_id}","starred_url":"https://api.github.com/users/sclevine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sclevine/subscriptions","organizations_url":"https://api.github.com/users/sclevine/orgs","repos_url":"https://api.github.com/users/sclevine/repos","events_url":"https://api.github.com/users/sclevine/events{/privacy}","received_events_url":"https://api.github.com/users/sclevine/received_events","type":"User","site_admin":false},"body":"Same as above: https://github.com/buildpack/samples/blob/master/nodejs-buildpack/bin/build#L53","created_at":"2018-08-29T19:12:01Z","updated_at":"2018-08-29T19:12:02Z","html_url":"https://github.com/buildpack/samples/pull/11#discussion_r213800794","pull_request_url":"https://api.github.com/repos/buildpack/samples/pulls/11","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/buildpack/samples/pulls/comments/213800794"},"html":{"href":"https://github.com/buildpack/samples/pull/11#discussion_r213800794"},"pull_request":{"href":"https://api.github.com/repos/buildpack/samples/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/buildpack/samples/pulls/11","id":211856001,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExODU2MDAx","html_url":"https://github.com/buildpack/samples/pull/11","diff_url":"https://github.com/buildpack/samples/pull/11.diff","patch_url":"https://github.com/buildpack/samples/pull/11.patch","issue_url":"https://api.github.com/repos/buildpack/samples/issues/11","number":11,"state":"open","locked":false,"title":"Fix rebuilding apps using JDK buildpack","user":{"login":"dgodd","id":126285,"node_id":"MDQ6VXNlcjEyNjI4NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/126285?v=4","gravatar_id":"","url":"https://api.github.com/users/dgodd","html_url":"https://github.com/dgodd","followers_url":"https://api.github.com/users/dgodd/followers","following_url":"https://api.github.com/users/dgodd/following{/other_user}","gists_url":"https://api.github.com/users/dgodd/gists{/gist_id}","starred_url":"https://api.github.com/users/dgodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgodd/subscriptions","organizations_url":"https://api.github.com/users/dgodd/orgs","repos_url":"https://api.github.com/users/dgodd/repos","events_url":"https://api.github.com/users/dgodd/events{/privacy}","received_events_url":"https://api.github.com/users/dgodd/received_events","type":"User","site_admin":false},"body":"The jdk buildpack was only creating the jdk layer directory if it would\r\nbe different to the previous build's layer. However, it was always\r\nsourcing a profile script from that same directory.\r\n\r\nIn fixing this, we have completed the 'TODO' items around using the\r\ncache for the jdk.\r\n\r\n[buildpack/lifecycle#12]\r\n\r\nSigned-off-by: Jacques Chester <jchester@pivotal.io>","created_at":"2018-08-29T19:06:01Z","updated_at":"2018-08-29T19:12:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c05b53dc25618803208562b865e24d04bbe52319","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/buildpack/samples/pulls/11/commits","review_comments_url":"https://api.github.com/repos/buildpack/samples/pulls/11/comments","review_comment_url":"https://api.github.com/repos/buildpack/samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/buildpack/samples/issues/11/comments","statuses_url":"https://api.github.com/repos/buildpack/samples/statuses/f8e9213a64de8cf2fe854b2abc6b8a4acb43a1ec","head":{"label":"buildpack:fix-jdk-bp-rebuild","ref":"fix-jdk-bp-rebuild","sha":"f8e9213a64de8cf2fe854b2abc6b8a4acb43a1ec","user":{"login":"buildpack","id":35551309,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTUxMzA5","avatar_url":"https://avatars3.githubusercontent.com/u/35551309?v=4","gravatar_id":"","url":"https://api.github.com/users/buildpack","html_url":"https://github.com/buildpack","followers_url":"https://api.github.com/users/buildpack/followers","following_url":"https://api.github.com/users/buildpack/following{/other_user}","gists_url":"https://api.github.com/users/buildpack/gists{/gist_id}","starred_url":"https://api.github.com/users/buildpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildpack/subscriptions","organizations_url":"https://api.github.com/users/buildpack/orgs","repos_url":"https://api.github.com/users/buildpack/repos","events_url":"https://api.github.com/users/buildpack/events{/privacy}","received_events_url":"https://api.github.com/users/buildpack/received_events","type":"Organization","site_admin":false},"repo":{"id":137955849,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc5NTU4NDk=","name":"samples","full_name":"buildpack/samples","owner":{"login":"buildpack","id":35551309,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTUxMzA5","avatar_url":"https://avatars3.githubusercontent.com/u/35551309?v=4","gravatar_id":"","url":"https://api.github.com/users/buildpack","html_url":"https://github.com/buildpack","followers_url":"https://api.github.com/users/buildpack/followers","following_url":"https://api.github.com/users/buildpack/following{/other_user}","gists_url":"https://api.github.com/users/buildpack/gists{/gist_id}","starred_url":"https://api.github.com/users/buildpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildpack/subscriptions","organizations_url":"https://api.github.com/users/buildpack/orgs","repos_url":"https://api.github.com/users/buildpack/repos","events_url":"https://api.github.com/users/buildpack/events{/privacy}","received_events_url":"https://api.github.com/users/buildpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/buildpack/samples","description":"Samples for buildpack creators","fork":false,"url":"https://api.github.com/repos/buildpack/samples","forks_url":"https://api.github.com/repos/buildpack/samples/forks","keys_url":"https://api.github.com/repos/buildpack/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buildpack/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buildpack/samples/teams","hooks_url":"https://api.github.com/repos/buildpack/samples/hooks","issue_events_url":"https://api.github.com/repos/buildpack/samples/issues/events{/number}","events_url":"https://api.github.com/repos/buildpack/samples/events","assignees_url":"https://api.github.com/repos/buildpack/samples/assignees{/user}","branches_url":"https://api.github.com/repos/buildpack/samples/branches{/branch}","tags_url":"https://api.github.com/repos/buildpack/samples/tags","blobs_url":"https://api.github.com/repos/buildpack/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buildpack/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buildpack/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/buildpack/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buildpack/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/buildpack/samples/languages","stargazers_url":"https://api.github.com/repos/buildpack/samples/stargazers","contributors_url":"https://api.github.com/repos/buildpack/samples/contributors","subscribers_url":"https://api.github.com/repos/buildpack/samples/subscribers","subscription_url":"https://api.github.com/repos/buildpack/samples/subscription","commits_url":"https://api.github.com/repos/buildpack/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/buildpack/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/buildpack/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/buildpack/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/buildpack/samples/contents/{+path}","compare_url":"https://api.github.com/repos/buildpack/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buildpack/samples/merges","archive_url":"https://api.github.com/repos/buildpack/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buildpack/samples/downloads","issues_url":"https://api.github.com/repos/buildpack/samples/issues{/number}","pulls_url":"https://api.github.com/repos/buildpack/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/buildpack/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/buildpack/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buildpack/samples/labels{/name}","releases_url":"https://api.github.com/repos/buildpack/samples/releases{/id}","deployments_url":"https://api.github.com/repos/buildpack/samples/deployments","created_at":"2018-06-19T23:24:56Z","updated_at":"2018-08-24T18:34:58Z","pushed_at":"2018-08-29T19:06:01Z","git_url":"git://github.com/buildpack/samples.git","ssh_url":"git@github.com:buildpack/samples.git","clone_url":"https://github.com/buildpack/samples.git","svn_url":"https://github.com/buildpack/samples","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"buildpack:master","ref":"master","sha":"9dd2042a5c383d0e66ed649d611e54f65f322f26","user":{"login":"buildpack","id":35551309,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTUxMzA5","avatar_url":"https://avatars3.githubusercontent.com/u/35551309?v=4","gravatar_id":"","url":"https://api.github.com/users/buildpack","html_url":"https://github.com/buildpack","followers_url":"https://api.github.com/users/buildpack/followers","following_url":"https://api.github.com/users/buildpack/following{/other_user}","gists_url":"https://api.github.com/users/buildpack/gists{/gist_id}","starred_url":"https://api.github.com/users/buildpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildpack/subscriptions","organizations_url":"https://api.github.com/users/buildpack/orgs","repos_url":"https://api.github.com/users/buildpack/repos","events_url":"https://api.github.com/users/buildpack/events{/privacy}","received_events_url":"https://api.github.com/users/buildpack/received_events","type":"Organization","site_admin":false},"repo":{"id":137955849,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc5NTU4NDk=","name":"samples","full_name":"buildpack/samples","owner":{"login":"buildpack","id":35551309,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NTUxMzA5","avatar_url":"https://avatars3.githubusercontent.com/u/35551309?v=4","gravatar_id":"","url":"https://api.github.com/users/buildpack","html_url":"https://github.com/buildpack","followers_url":"https://api.github.com/users/buildpack/followers","following_url":"https://api.github.com/users/buildpack/following{/other_user}","gists_url":"https://api.github.com/users/buildpack/gists{/gist_id}","starred_url":"https://api.github.com/users/buildpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildpack/subscriptions","organizations_url":"https://api.github.com/users/buildpack/orgs","repos_url":"https://api.github.com/users/buildpack/repos","events_url":"https://api.github.com/users/buildpack/events{/privacy}","received_events_url":"https://api.github.com/users/buildpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/buildpack/samples","description":"Samples for buildpack creators","fork":false,"url":"https://api.github.com/repos/buildpack/samples","forks_url":"https://api.github.com/repos/buildpack/samples/forks","keys_url":"https://api.github.com/repos/buildpack/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buildpack/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buildpack/samples/teams","hooks_url":"https://api.github.com/repos/buildpack/samples/hooks","issue_events_url":"https://api.github.com/repos/buildpack/samples/issues/events{/number}","events_url":"https://api.github.com/repos/buildpack/samples/events","assignees_url":"https://api.github.com/repos/buildpack/samples/assignees{/user}","branches_url":"https://api.github.com/repos/buildpack/samples/branches{/branch}","tags_url":"https://api.github.com/repos/buildpack/samples/tags","blobs_url":"https://api.github.com/repos/buildpack/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buildpack/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buildpack/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/buildpack/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buildpack/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/buildpack/samples/languages","stargazers_url":"https://api.github.com/repos/buildpack/samples/stargazers","contributors_url":"https://api.github.com/repos/buildpack/samples/contributors","subscribers_url":"https://api.github.com/repos/buildpack/samples/subscribers","subscription_url":"https://api.github.com/repos/buildpack/samples/subscription","commits_url":"https://api.github.com/repos/buildpack/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/buildpack/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/buildpack/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/buildpack/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/buildpack/samples/contents/{+path}","compare_url":"https://api.github.com/repos/buildpack/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buildpack/samples/merges","archive_url":"https://api.github.com/repos/buildpack/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buildpack/samples/downloads","issues_url":"https://api.github.com/repos/buildpack/samples/issues{/number}","pulls_url":"https://api.github.com/repos/buildpack/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/buildpack/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/buildpack/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buildpack/samples/labels{/name}","releases_url":"https://api.github.com/repos/buildpack/samples/releases{/id}","deployments_url":"https://api.github.com/repos/buildpack/samples/deployments","created_at":"2018-06-19T23:24:56Z","updated_at":"2018-08-24T18:34:58Z","pushed_at":"2018-08-29T19:06:01Z","git_url":"git://github.com/buildpack/samples.git","ssh_url":"git@github.com:buildpack/samples.git","clone_url":"https://github.com/buildpack/samples.git","svn_url":"https://github.com/buildpack/samples","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/buildpack/samples/pulls/11"},"html":{"href":"https://github.com/buildpack/samples/pull/11"},"issue":{"href":"https://api.github.com/repos/buildpack/samples/issues/11"},"comments":{"href":"https://api.github.com/repos/buildpack/samples/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/buildpack/samples/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/buildpack/samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/buildpack/samples/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/buildpack/samples/statuses/f8e9213a64de8cf2fe854b2abc6b8a4acb43a1ec"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sclevine"}}