{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/comments/28518486","id":28518486,"diff_hunk":"@@ -1,55 +1,73 @@\n+/*\n+ * The MIT License\n+ *\n+ * Copyright (c) 2015, CloudBees, Inc.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n package org.jenkinsci.plugins.docker.commons;\n \n import hudson.EnvVars;\n-import hudson.model.AbstractBuild;\n-import org.jenkinsci.plugins.docker.commons.impl.CompositeKeyMaterial;\n-import org.jenkinsci.plugins.docker.commons.impl.NullKeyMaterial;\n \n-import javax.annotation.Nullable;\n import java.io.Closeable;\n import java.io.IOException;\n import java.io.Serializable;\n \n /**\n- * Represents a locally extracted credentials information.\n- *\n- * <p>\n- * Whenever you want to fork off docker directly or indirectly, use this object to set up environment variables\n- * so that docker will talk to the right daemon.\n- *\n- * <p>\n- * When you are done using the credentials, call {@link #close()} to allow sensitive information to be removed\n- * from the disk.","path":"src/main/java/org/jenkinsci/plugins/docker/commons/KeyMaterial.java","position":45,"original_position":45,"commit_id":"02ad6c600816fd193dae5786fb422b1dd6554bb5","original_commit_id":"02ad6c600816fd193dae5786fb422b1dd6554bb5","user":{"login":"jglick","id":154109,"avatar_url":"https://avatars.githubusercontent.com/u/154109?v=3","gravatar_id":"","url":"https://api.github.com/users/jglick","html_url":"https://github.com/jglick","followers_url":"https://api.github.com/users/jglick/followers","following_url":"https://api.github.com/users/jglick/following{/other_user}","gists_url":"https://api.github.com/users/jglick/gists{/gist_id}","starred_url":"https://api.github.com/users/jglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jglick/subscriptions","organizations_url":"https://api.github.com/users/jglick/orgs","repos_url":"https://api.github.com/users/jglick/repos","events_url":"https://api.github.com/users/jglick/events{/privacy}","received_events_url":"https://api.github.com/users/jglick/received_events","type":"User","site_admin":false},"body":"I think this Javadoc still applies; is there a reason you deleted it?","created_at":"2015-04-16T15:14:00Z","updated_at":"2015-04-16T15:14:00Z","html_url":"https://github.com/jenkinsci/docker-commons-plugin/pull/11#discussion_r28518486","pull_request_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/comments/28518486"},"html":{"href":"https://github.com/jenkinsci/docker-commons-plugin/pull/11#discussion_r28518486"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11","id":33342098,"html_url":"https://github.com/jenkinsci/docker-commons-plugin/pull/11","diff_url":"https://github.com/jenkinsci/docker-commons-plugin/pull/11.diff","patch_url":"https://github.com/jenkinsci/docker-commons-plugin/pull/11.patch","issue_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/11","number":11,"state":"open","locked":false,"title":"Split KeyMaterial out into KeyMaterialFactory and KeyMaterial","user":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"body":"It is ugly for `KeyMaterial` to be stateful and require a call to `close`.\r\n\r\n__NOTE__: The changes here look more than they really are. It's mostly just moving existing code around a bit.\r\n\r\nWhat we're suggesting here is that `KeyMaterial` would still require to be closed, but would only be created and closed at the point where it is needed (and not further back up the call stack). Instead, whatever potentially needs the creds would be given a `KeyMaterialFactory` and if they need the `KeyMaterial` they call `KeyMaterialFactory.materialize` exactly at the point where the creds are needed, and then `KeyMaterial.close` immediately after it finishes using them, making the `KeyMaterial` lifecycle a bit easier to manage.","created_at":"2015-04-15T10:38:02Z","updated_at":"2015-04-16T15:14:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e40072cc12277007e014f6e814d94e90687f7091","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/11/comments","statuses_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/statuses/02ad6c600816fd193dae5786fb422b1dd6554bb5","head":{"label":"tfennelly:KeyMaterialFactory","ref":"KeyMaterialFactory","sha":"02ad6c600816fd193dae5786fb422b1dd6554bb5","user":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"repo":{"id":33612138,"name":"docker-commons-plugin","full_name":"tfennelly/docker-commons-plugin","owner":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tfennelly/docker-commons-plugin","description":"","fork":true,"url":"https://api.github.com/repos/tfennelly/docker-commons-plugin","forks_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/forks","keys_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/teams","hooks_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/hooks","issue_events_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/events","assignees_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/tags","blobs_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/languages","stargazers_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/stargazers","contributors_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/contributors","subscribers_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/subscribers","subscription_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/subscription","commits_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/merges","archive_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/downloads","issues_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/labels{/name}","releases_url":"https://api.github.com/repos/tfennelly/docker-commons-plugin/releases{/id}","created_at":"2015-04-08T14:32:05Z","updated_at":"2015-04-08T14:32:05Z","pushed_at":"2015-04-15T22:24:35Z","git_url":"git://github.com/tfennelly/docker-commons-plugin.git","ssh_url":"git@github.com:tfennelly/docker-commons-plugin.git","clone_url":"https://github.com/tfennelly/docker-commons-plugin.git","svn_url":"https://github.com/tfennelly/docker-commons-plugin","homepage":"","size":254,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"7507e04247453f4443631c939799257051405010","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":33572296,"name":"docker-commons-plugin","full_name":"jenkinsci/docker-commons-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/docker-commons-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin","forks_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/releases{/id}","created_at":"2015-04-07T22:49:23Z","updated_at":"2015-04-16T15:11:19Z","pushed_at":"2015-04-16T15:11:19Z","git_url":"git://github.com/jenkinsci/docker-commons-plugin.git","ssh_url":"git@github.com:jenkinsci/docker-commons-plugin.git","clone_url":"https://github.com/jenkinsci/docker-commons-plugin.git","svn_url":"https://github.com/jenkinsci/docker-commons-plugin","homepage":"","size":1773,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11"},"html":{"href":"https://github.com/jenkinsci/docker-commons-plugin/pull/11"},"issue":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/11"},"comments":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/docker-commons-plugin/statuses/02ad6c600816fd193dae5786fb422b1dd6554bb5"}}}}