{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/comments/36129454","id":36129454,"diff_hunk":"@@ -0,0 +1,112 @@\n+package com.cloudbees.jenkins.plugins.sshagent;\n+\n+import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey;\n+import com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey;\n+import com.cloudbees.plugins.credentials.CredentialsScope;\n+import com.cloudbees.plugins.credentials.SystemCredentialsProvider;\n+import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;\n+import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution;\n+import org.jenkinsci.plugins.workflow.job.WorkflowJob;\n+import org.jenkinsci.plugins.workflow.job.WorkflowRun;\n+import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;\n+import org.junit.ClassRule;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.runners.model.Statement;\n+import org.jvnet.hudson.test.BuildWatcher;\n+import org.jvnet.hudson.test.JenkinsRule;\n+import org.jvnet.hudson.test.RestartableJenkinsRule;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import static org.junit.Assert.assertTrue;\n+\n+public class SSHAgentStepWorkflowTest extends SSHAgentBase {\n+\n+    @Rule\n+    public RestartableJenkinsRule story = new RestartableJenkinsRule();\n+\n+    @ClassRule\n+    public static BuildWatcher buildWatcher = new BuildWatcher();\n+\n+    @Test\n+    public void sshAgentAvailable() throws Exception {\n+        story.addStep(new Statement() {\n+            @Override\n+            public void evaluate() throws Throwable {\n+                startMockSSHServer();\n+\n+                List<String> credentialIds = new ArrayList<String>();\n+                credentialIds.add(CREDENTIAL_ID);\n+\n+                SSHUserPrivateKey key = new BasicSSHUserPrivateKey(CredentialsScope.GLOBAL, credentialIds.get(0), \"cloudbees\",\n+                        new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(getPrivateKey()), \"cloudbees\", \"test\");\n+                SystemCredentialsProvider.getInstance().getCredentials().add(key);\n+                SystemCredentialsProvider.getInstance().save();\n+\n+                WorkflowJob job = story.j.jenkins.createProject(WorkflowJob.class, \"sshAgentAvailable\");","path":"src/test/java/com/cloudbees/jenkins/plugins/sshagent/SSHAgentStepWorkflowTest.java","position":48,"original_position":48,"commit_id":"58ea933ce7821ead2a042be499a8a380fa9a671a","original_commit_id":"58ea933ce7821ead2a042be499a8a380fa9a671a","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":"Tip: there is no need to pick a unique project name. Each test case runs in its own `$JENKINS_HOME` / `Jenkins.instance`.","created_at":"2015-08-03T20:46:15Z","updated_at":"2015-08-03T20:46:15Z","html_url":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4#discussion_r36129454","pull_request_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/comments/36129454"},"html":{"href":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4#discussion_r36129454"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4","id":40141880,"html_url":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4","diff_url":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4.diff","patch_url":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4.patch","issue_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/4","number":4,"state":"open","locked":false,"title":"[JENKINS-28689] Make compatible with Workflow plugin","user":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"body":"Downstream of https://github.com/jenkinsci/workflow-plugin/pull/161\r\n\r\nhttps://issues.jenkins-ci.org/browse/JENKINS-28689\r\n\r\n- [x] Initial source code modifications\r\n- [x] Implement a basic mocked SSH Server\r\n- [x] Add a test to verify that SSH Agent is working how we expect\r\n- [x] Add a test to verify that SSH Agent is working how we expect using a Workflow script\r\n- [x] Implement `SSHAgentStep`, `DescriptorImpl` and `SSHAgentExecution`\r\n- [x] Review the documentation\r\n- [x] Add more tests","created_at":"2015-07-16T15:27:43Z","updated_at":"2015-08-03T20:46:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edc2ce7cb99742d84a2af35e602cb1da662c03cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/4/comments","statuses_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/statuses/58ea933ce7821ead2a042be499a8a380fa9a671a","head":{"label":"recena:JENKINS-28689","ref":"JENKINS-28689","sha":"58ea933ce7821ead2a042be499a8a380fa9a671a","user":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"repo":{"id":38837521,"name":"ssh-agent-plugin","full_name":"recena/ssh-agent-plugin","owner":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/recena/ssh-agent-plugin","description":"","fork":true,"url":"https://api.github.com/repos/recena/ssh-agent-plugin","forks_url":"https://api.github.com/repos/recena/ssh-agent-plugin/forks","keys_url":"https://api.github.com/repos/recena/ssh-agent-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/recena/ssh-agent-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/recena/ssh-agent-plugin/teams","hooks_url":"https://api.github.com/repos/recena/ssh-agent-plugin/hooks","issue_events_url":"https://api.github.com/repos/recena/ssh-agent-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/recena/ssh-agent-plugin/events","assignees_url":"https://api.github.com/repos/recena/ssh-agent-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/recena/ssh-agent-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/recena/ssh-agent-plugin/tags","blobs_url":"https://api.github.com/repos/recena/ssh-agent-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/recena/ssh-agent-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/recena/ssh-agent-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/recena/ssh-agent-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/recena/ssh-agent-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/recena/ssh-agent-plugin/languages","stargazers_url":"https://api.github.com/repos/recena/ssh-agent-plugin/stargazers","contributors_url":"https://api.github.com/repos/recena/ssh-agent-plugin/contributors","subscribers_url":"https://api.github.com/repos/recena/ssh-agent-plugin/subscribers","subscription_url":"https://api.github.com/repos/recena/ssh-agent-plugin/subscription","commits_url":"https://api.github.com/repos/recena/ssh-agent-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/recena/ssh-agent-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/recena/ssh-agent-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/recena/ssh-agent-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/recena/ssh-agent-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/recena/ssh-agent-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/recena/ssh-agent-plugin/merges","archive_url":"https://api.github.com/repos/recena/ssh-agent-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/recena/ssh-agent-plugin/downloads","issues_url":"https://api.github.com/repos/recena/ssh-agent-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/recena/ssh-agent-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/recena/ssh-agent-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/recena/ssh-agent-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/recena/ssh-agent-plugin/labels{/name}","releases_url":"https://api.github.com/repos/recena/ssh-agent-plugin/releases{/id}","created_at":"2015-07-09T18:18:10Z","updated_at":"2015-07-09T18:18:10Z","pushed_at":"2015-08-03T17:20:37Z","git_url":"git://github.com/recena/ssh-agent-plugin.git","ssh_url":"git@github.com:recena/ssh-agent-plugin.git","clone_url":"https://github.com/recena/ssh-agent-plugin.git","svn_url":"https://github.com/recena/ssh-agent-plugin","homepage":"","size":242,"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":"6277e6b0e7e2cbb65ba8c23388015773e12481ea","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":6402426,"name":"ssh-agent-plugin","full_name":"jenkinsci/ssh-agent-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/ssh-agent-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin","forks_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/releases{/id}","created_at":"2012-10-26T10:55:18Z","updated_at":"2015-07-18T18:52:55Z","pushed_at":"2015-08-03T17:20:37Z","git_url":"git://github.com/jenkinsci/ssh-agent-plugin.git","ssh_url":"git@github.com:jenkinsci/ssh-agent-plugin.git","clone_url":"https://github.com/jenkinsci/ssh-agent-plugin.git","svn_url":"https://github.com/jenkinsci/ssh-agent-plugin","homepage":"","size":803,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":2,"forks":13,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4"},"html":{"href":"https://github.com/jenkinsci/ssh-agent-plugin/pull/4"},"issue":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/4"},"comments":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/ssh-agent-plugin/statuses/58ea933ce7821ead2a042be499a8a380fa9a671a"}}}}