diff --git a/src/main/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfiguration.java b/src/main/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfiguration.java index e6ca3be7..e1cca046 100644 --- a/src/main/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfiguration.java +++ b/src/main/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfiguration.java @@ -54,12 +54,11 @@ public BuildConfiguration(Map config) { this.config = config; } - public ShellCommands getBeforeRunCommandWithCheckoutIfPresent(Map dotCiEnvVars) { + public ShellCommands getBeforeRunCommandIfPresent() { if (!config.containsKey("before_run")) { return null; } ShellCommands shellCommands = new ShellCommands(); - shellCommands.add(getCheckoutCommands(dotCiEnvVars)); shellCommands.add(String.format("sh -xc '%s'", SHELL_ESCAPE.escape((String) config.get("before_run")))); return shellCommands; } @@ -70,7 +69,7 @@ public ShellCommands getCommands(Combination combination, Map do String fileName = getDockerComposeFileName(); ShellCommands shellCommands = new ShellCommands(); - shellCommands.add(getCheckoutCommands(dotCiEnvVars)); + shellCommands.add(BuildConfiguration.getCheckoutCommands(dotCiEnvVars)); if (config.containsKey("before_run") && !isParallelized()) { shellCommands.add(String.format("sh -xc '%s'", SHELL_ESCAPE.escape((String) config.get("before_run")))); @@ -147,7 +146,8 @@ public List getNotifiers() { public String getDockerComposeFileName() { return config.get("docker-compose-file") !=null ? (String) config.get("docker-compose-file") : "docker-compose.yml"; } - private ShellCommands getCheckoutCommands(Map dotCiEnvVars) { + + public static ShellCommands getCheckoutCommands(Map dotCiEnvVars) { String gitCloneUrl = (String) dotCiEnvVars.get("DOTCI_DOCKER_COMPOSE_GIT_CLONE_URL"); GitUrl gitRepoUrl = new GitUrl(gitCloneUrl); boolean isPrivateRepo = Boolean.parseBoolean((String) dotCiEnvVars.get("DOTCI_IS_PRIVATE_REPO")); diff --git a/src/main/java/com/groupon/jenkins/buildtype/dockercompose/DockerComposeBuild.java b/src/main/java/com/groupon/jenkins/buildtype/dockercompose/DockerComposeBuild.java index 45f30aa5..e00950be 100644 --- a/src/main/java/com/groupon/jenkins/buildtype/dockercompose/DockerComposeBuild.java +++ b/src/main/java/com/groupon/jenkins/buildtype/dockercompose/DockerComposeBuild.java @@ -35,9 +35,11 @@ import com.groupon.jenkins.dynamic.build.execution.SubBuildRunner; import com.groupon.jenkins.dynamic.build.execution.SubBuildScheduler; import com.groupon.jenkins.dynamic.buildtype.BuildType; +import com.groupon.jenkins.git.GitUrl; import com.groupon.jenkins.notifications.PostBuildNotifier; import com.groupon.jenkins.util.GroovyYamlTemplateProcessor; import hudson.Extension; +import hudson.FilePath; import hudson.Launcher; import hudson.matrix.Combination; import hudson.model.BuildListener; @@ -48,6 +50,8 @@ import java.util.List; import java.util.Map; +import static java.lang.String.format; + @Extension public class DockerComposeBuild extends BuildType implements SubBuildRunner { private BuildConfiguration buildConfiguration; @@ -60,11 +64,16 @@ public String getDescription() { @Override public Result runBuild(DynamicBuild build, BuildExecutionContext buildExecutionContext, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { Map buildEnvironment = build.getEnvironmentWithChangeSet(listener); + + Result result = doCheckout(buildEnvironment, buildExecutionContext, listener); + if (!Result.SUCCESS.equals(result)) { + return result; + } + Map config = new GroovyYamlTemplateProcessor(getDotCiYml(build), buildEnvironment).getConfig(); this.buildConfiguration = new BuildConfiguration(config); build.setAxisList(buildConfiguration.getAxisList()); - Result result; if(buildConfiguration.isParallelized()){ result = runParallelBuild(build, buildExecutionContext, buildConfiguration, listener); }else{ @@ -82,17 +91,23 @@ public Result runSubBuild(Combination combination, BuildExecutionContext buildEx return runCommands(commands, buildExecutionContext, listener); } + private Result doCheckout(Map buildEnvironment, BuildExecutionContext buildExecutionContext, BuildListener listener) throws IOException, InterruptedException { + ShellCommands commands = BuildConfiguration.getCheckoutCommands(buildEnvironment); + return runCommands(commands, buildExecutionContext, listener); + } + private Result runCommands(ShellCommands commands, BuildExecutionContext buildExecutionContext, BuildListener listener) throws IOException, InterruptedException { ShellScriptRunner shellScriptRunner = new ShellScriptRunner(buildExecutionContext, listener); return shellScriptRunner.runScript(commands); } - private String getDotCiYml(DynamicBuild build) throws IOException { - try { - return build.getGithubRepositoryService().getGHFile(".ci.yml", build.getSha()).getContent(); - } catch (FileNotFoundException _){ + private String getDotCiYml(DynamicBuild build) throws IOException, InterruptedException { + FilePath fp = new FilePath(build.getWorkspace(), ".ci.yml"); + if (!fp.exists()) { throw new InvalidBuildConfigurationException("No .ci.yml found."); } + + return fp.readToString(); } private Result runParallelBuild(final DynamicBuild dynamicBuild, final BuildExecutionContext buildExecutionContext, final BuildConfiguration buildConfiguration, final BuildListener listener) throws IOException, InterruptedException { @@ -122,7 +137,7 @@ public void runFinished(DynamicSubBuild subBuild) throws IOException { } private Result runBeforeCommands(final BuildExecutionContext buildExecutionContext, final BuildListener listener) throws IOException, InterruptedException { - ShellCommands beforeCommands = buildConfiguration.getBeforeRunCommandWithCheckoutIfPresent(buildExecutionContext.getBuildEnvironmentVariables()); + ShellCommands beforeCommands = buildConfiguration.getBeforeRunCommandIfPresent(); if (beforeCommands != null) { return runCommands(beforeCommands, buildExecutionContext, listener); } diff --git a/src/main/java/com/groupon/jenkins/dynamic/build/DynamicProject.java b/src/main/java/com/groupon/jenkins/dynamic/build/DynamicProject.java index 584a6dac..2439f294 100644 --- a/src/main/java/com/groupon/jenkins/dynamic/build/DynamicProject.java +++ b/src/main/java/com/groupon/jenkins/dynamic/build/DynamicProject.java @@ -115,12 +115,6 @@ public boolean shouldBuildTags() { return getProperty(BuildTagsProperty.class)!=null && getProperty(BuildTagsProperty.class).isShouldBuildTags(); } - public boolean shouldBuildPullRequestFromSameRepo() { - PullRequestRebuildProperty buildPrProperty = getProperty(PullRequestRebuildProperty.class); - return buildPrProperty !=null && buildPrProperty.shouldRebuildPullRequestsFromSameRepo(); - - } - public static final class DescriptorImpl extends AbstractProjectDescriptor { /** * We are hiding the "DotCI" project from "/newJob" page, because we'll diff --git a/src/main/java/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty.java b/src/main/java/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty.java index 1047b23d..a83ddd72 100644 --- a/src/main/java/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty.java +++ b/src/main/java/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty.java @@ -23,11 +23,11 @@ */ package com.groupon.jenkins.dynamic.build; -import hudson.*; import hudson.model.*; import net.sf.json.*; import org.kohsuke.stapler.*; +@Deprecated public class PullRequestRebuildProperty extends JobProperty> { private final boolean buildPullRequestsFromSameRepo; @@ -41,7 +41,6 @@ public boolean shouldRebuildPullRequestsFromSameRepo() { } - @Extension public static final class PullRequestRebuildPropertyDescriptor extends JobPropertyDescriptor { @Override diff --git a/src/main/java/com/groupon/jenkins/github/GithubWebhook.java b/src/main/java/com/groupon/jenkins/github/GithubWebhook.java index 9f1e096b..e7a5f0b5 100644 --- a/src/main/java/com/groupon/jenkins/github/GithubWebhook.java +++ b/src/main/java/com/groupon/jenkins/github/GithubWebhook.java @@ -81,7 +81,7 @@ public void processGitHubPayload(String payloadData) { LOGGER.info("Received kicking off build for " + payload.getProjectUrl()); for (final DynamicProject job : makeDynamicProjectRepo().getJobsFor(payload.getProjectUrl())) { - if (payload.needsBuild(job.shouldBuildTags(), job.shouldBuildPullRequestFromSameRepo())) { + if (payload.needsBuild(job.shouldBuildTags())) { LOGGER.info("starting job" + job.getName()); queue.execute(new Runnable() { @Override diff --git a/src/main/java/com/groupon/jenkins/github/Payload.java b/src/main/java/com/groupon/jenkins/github/Payload.java index 76da3dc7..1afeba56 100644 --- a/src/main/java/com/groupon/jenkins/github/Payload.java +++ b/src/main/java/com/groupon/jenkins/github/Payload.java @@ -76,26 +76,25 @@ public String getBranch() { return payloadJson.getString("ref").replaceAll("refs/", "").replaceAll("heads/", ""); } - public boolean needsBuild(boolean shouldBuildTags, boolean buildPrsFromSameRepo) { + public boolean needsBuild(boolean shouldBuildTags) { if (payloadJson.has("ref") && payloadJson.getString("ref").startsWith("refs/tags/")) { return shouldBuildTags; } if (isPullRequest()) { - return shouldBuildPullRequest(buildPrsFromSameRepo); + return shouldBuildPullRequest(); } return !payloadJson.getBoolean("deleted"); } - private boolean shouldBuildPullRequest(boolean buildPrsFromSameRepo) { + private boolean shouldBuildPullRequest() { return !isPullRequestClosed() && - shouldBuildPullRequestBasedOnAction() && - ( buildPrsFromSameRepo || !isPullRequestFromWithinSameRepo()); + shouldBuildPullRequestBasedOnAction(); } //only build for webhook actions of "opened", "reopened", or "synchronize" //https://developer.github.com/v3/activity/events/types/#events-api-payload-17 private boolean shouldBuildPullRequestBasedOnAction() { - return isOpenedAction() || isReOpenedAction() || isSynchronizeAction(); + return isOpenedAction() || isReOpenedAction() || isSynchronizeAction(); } private boolean isPullRequestClosed() { @@ -107,17 +106,11 @@ private boolean isOpenedAction() { } private boolean isReOpenedAction() { - return isPullRequest() && "reopened".equals(payloadJson.getString("action")); + return isPullRequest() && "reopened".equals(payloadJson.getString("action")); } private boolean isSynchronizeAction() { - return isPullRequest() && "synchronize".equals(payloadJson.getString("action")); - } - - private boolean isPullRequestFromWithinSameRepo() { - String headRepoUrl = getPullRequest().getJSONObject("head").getJSONObject("repo").getString("ssh_url"); - String pullRequestRepoUrl = getPullRequest().getJSONObject("base").getJSONObject("repo").getString("ssh_url"); - return headRepoUrl.equals(pullRequestRepoUrl); + return isPullRequest() && "synchronize".equals(payloadJson.getString("action")); } public String getPullRequestSourceBranch() { diff --git a/src/main/resources/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty/config.groovy b/src/main/resources/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty/config.groovy deleted file mode 100644 index d07f0522..00000000 --- a/src/main/resources/com/groupon/jenkins/dynamic/build/PullRequestRebuildProperty/config.groovy +++ /dev/null @@ -1,29 +0,0 @@ -/* -The MIT License (MIT) - -Copyright (c) 2014, Groupon, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - */ -package com.groupon.jenkins.dynamic.build; -def f=namespace(lib.FormTagLib) - -f.entry(title:_("Build Pull Requests from the same Repository"), field:"buildPullRequestsFromSameRepo") { - f.checkbox(name:"buildPullRequestsFromSameRepo", checked: instance && instance.shouldRebuildPullRequestsFromSameRepo() ) -} diff --git a/src/test/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfigurationTest.java b/src/test/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfigurationTest.java index d3ff0012..8e4be4f2 100644 --- a/src/test/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfigurationTest.java +++ b/src/test/java/com/groupon/jenkins/buildtype/dockercompose/BuildConfigurationTest.java @@ -77,15 +77,10 @@ public void should_run_before_run_command_in_before_run_if_present(){ } @Test - public void should_run_before_run_with_checkout_command_with_non_parallel_build(){ + public void should_run_before_run_with_parallel_build(){ BuildConfiguration buildConfiguration = new BuildConfiguration(ImmutableMap.of("before_run", "before_run cmd", "run", of("unit", "command", "integration", "integration"))); - ShellCommands commands = buildConfiguration.getBeforeRunCommandWithCheckoutIfPresent(getEnvVars()); - Assert.assertEquals("chmod -R u+w . ; find . ! -path \"./deploykey_rsa.pub\" ! -path \"./deploykey_rsa\" -delete", commands.get(0)); - Assert.assertEquals("git init", commands.get(1)); - Assert.assertEquals("git remote add origin git@github.com:groupon/DotCi.git", commands.get(2)); - Assert.assertEquals("git fetch origin master", commands.get(3)); - Assert.assertEquals("git reset --hard abc123", commands.get(4)); - Assert.assertEquals("sh -xc 'before_run cmd'", commands.get(6)); + ShellCommands commands = buildConfiguration.getBeforeRunCommandIfPresent(); + Assert.assertEquals("sh -xc 'before_run cmd'", commands.get(0)); } @Test diff --git a/src/test/java/com/groupon/jenkins/github/GithubWebhookTest.java b/src/test/java/com/groupon/jenkins/github/GithubWebhookTest.java index 7ed597c7..1169919e 100644 --- a/src/test/java/com/groupon/jenkins/github/GithubWebhookTest.java +++ b/src/test/java/com/groupon/jenkins/github/GithubWebhookTest.java @@ -133,7 +133,7 @@ protected void kickOffBuildTrigger(StaplerRequest request, DynamicProject projec DynamicProjectRepository projectRepo = mock(DynamicProjectRepository.class); - when(payload.needsBuild(false,false)).thenReturn(true); + when(payload.needsBuild(false)).thenReturn(true); when(payload.getProjectUrl()).thenReturn("git@repo"); when(projectRepo.getJobsFor("git@repo")).thenReturn(newArrayList(projectForRepo)); diff --git a/src/test/java/com/groupon/jenkins/github/PayloadTest.java b/src/test/java/com/groupon/jenkins/github/PayloadTest.java index 36c1a681..d532096e 100644 --- a/src/test/java/com/groupon/jenkins/github/PayloadTest.java +++ b/src/test/java/com/groupon/jenkins/github/PayloadTest.java @@ -71,52 +71,51 @@ public void testProjectPullRequestUnmergableBranch() throws IOException { @Test public void testProjectPushDeleteBranch() throws IOException { Payload payload = new Payload(readFile("push_delete.json")); - assertFalse(payload.needsBuild(false,false)); + assertFalse(payload.needsBuild(false)); } @Test - public void pullRequestLabeledShouldNotTriggerABuild() throws IOException { - Payload payload = new Payload(readFile("pull_request_labeled.json")); - assertFalse(payload.needsBuild(false,true)); + public void pullRequestOpenedShouldTriggerABuild() throws IOException { + Payload payload = new Payload(readFile("pull_request_opened.json")); + assertTrue(payload.needsBuild(false)); } @Test public void pullRequestReopenedShouldTriggerABuild() throws IOException { String payloadReq = readFile("pull_request_reopened.json"); Payload payload = new Payload(payloadReq); - assertTrue(payload.needsBuild(false, true)); + assertTrue(payload.needsBuild(false)); } @Test - public void testNonDeletePushShouldTriggerAbuild() throws IOException { - Payload payload = new Payload(readFile("push.json")); - assertTrue(payload.needsBuild(false,false)); + public void pullRequestSynchronizeShouldTriggerABuild() throws IOException { + String payloadReq = readFile("pull_request_synchronized.json"); + Payload payload = new Payload(payloadReq); + assertTrue(payload.needsBuild(false)); } @Test - public void pullRequestFromTheSameRepoShouldNotTriggerABuild() throws IOException { - String payloadReq = readFile("pull_request_from_the_same_repo.json"); - Payload payload = new Payload(payloadReq); - assertFalse(payload.needsBuild(false,false)); + public void pullRequestLabeledShouldNotTriggerABuild() throws IOException { + Payload payload = new Payload(readFile("pull_request_labeled.json")); + assertFalse(payload.needsBuild(false)); } @Test - public void pullRequestFromTheSameRepoShouldTriggerABuildIfAllowed() throws IOException { - String payloadReq = readFile("pull_request_from_the_same_repo.json"); - Payload payload = new Payload(payloadReq); - assertTrue(payload.needsBuild(false, true)); + public void testNonDeletePushShouldTriggerAbuild() throws IOException { + Payload payload = new Payload(readFile("push.json")); + assertTrue(payload.needsBuild(false)); } @Test public void pullRequestFromForkShouldTriggerABuild() throws IOException { Payload payload = new Payload(readFile("pull_request_from_fork.json")); - assertTrue(payload.needsBuild(false,false)); + assertTrue(payload.needsBuild(false)); } @Test public void closedPullRequestFromForkShouldNotTriggerABuild() throws IOException { Payload payload = new Payload(readFile("pull_request_from_fork_closed.json")); - assertFalse(payload.needsBuild(false,false)); + assertFalse(payload.needsBuild(false)); } @Test @@ -172,12 +171,12 @@ public void branchDescriptionForPullRequest() throws IOException { @Test public void should_not_build_tags() throws IOException { Payload payload = new Payload(readFile("push_tags.json")); - Assert.assertFalse(payload.needsBuild(false,false)); + Assert.assertFalse(payload.needsBuild(false)); } @Test public void should_build_tags_if_specified_in_project_config() throws IOException { Payload payload = new Payload(readFile("push_tags.json")); - Assert.assertTrue(payload.needsBuild(true,false)); + Assert.assertTrue(payload.needsBuild(true)); } @Test diff --git a/src/test/resources/pull_request_opened.json b/src/test/resources/pull_request_opened.json new file mode 100644 index 00000000..95950e9d --- /dev/null +++ b/src/test/resources/pull_request_opened.json @@ -0,0 +1,423 @@ +{ + "action": "opened", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/test/test/pulls/1", + "id": 51254965, + "html_url": "https://github.com/test/test/pull/1", + "diff_url": "https://github.com/test/test/pull/1.diff", + "patch_url": "https://github.com/test/test/pull/1.patch", + "issue_url": "https://api.github.com/repos/test/test/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "testing source, target branches", + "user": { + "login": "a", + "id": 123, + "avatar_url": "https://avatars.githubusercontent.com/u/123?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/a", + "html_url": "https://github.com/a", + "followers_url": "https://api.github.com/users/a/followers", + "following_url": "https://api.github.com/users/a/following{/other_user}", + "gists_url": "https://api.github.com/users/a/gists{/gist_id}", + "starred_url": "https://api.github.com/users/a/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/a/subscriptions", + "organizations_url": "https://api.github.com/users/a/orgs", + "repos_url": "https://api.github.com/users/a/repos", + "events_url": "https://api.github.com/users/a/events{/privacy}", + "received_events_url": "https://api.github.com/users/a/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2015-11-19T17:36:18Z", + "updated_at": "2015-11-19T17:36:18Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "57091507bca3900ff95d876406dc471571ff706b", + "assignee": null, + "milestone": null, + "commits_url": "https://api.github.com/repos/test/test/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/test/test/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/test/test/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/test/test/issues/1/comments", + "statuses_url": "https://api.github.com/repos/test/test/statuses/74e73762209d23d19e88f1ded82be30ede0e3d4b", + "head": { + "label": "test:target_source", + "ref": "target_source", + "sha": "74e73762209d23d19e88f1ded82be30ede0e3d4b", + "user": { + "login": "test", + "id": 1234, + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/test", + "html_url": "https://github.com/test", + "followers_url": "https://api.github.com/users/test/followers", + "following_url": "https://api.github.com/users/test/following{/other_user}", + "gists_url": "https://api.github.com/users/test/gists{/gist_id}", + "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/test/subscriptions", + "organizations_url": "https://api.github.com/users/test/orgs", + "repos_url": "https://api.github.com/users/test/repos", + "events_url": "https://api.github.com/users/test/events{/privacy}", + "received_events_url": "https://api.github.com/users/test/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 44753409, + "name": "test", + "full_name": "test/test", + "owner": { + "login": "test", + "id": 1234, + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/test", + "html_url": "https://github.com/test", + "followers_url": "https://api.github.com/users/test/followers", + "following_url": "https://api.github.com/users/test/following{/other_user}", + "gists_url": "https://api.github.com/users/test/gists{/gist_id}", + "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/test/subscriptions", + "organizations_url": "https://api.github.com/users/test/orgs", + "repos_url": "https://api.github.com/users/test/repos", + "events_url": "https://api.github.com/users/test/events{/privacy}", + "received_events_url": "https://api.github.com/users/test/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/test/test", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/test/test", + "forks_url": "https://api.github.com/repos/test/test/forks", + "keys_url": "https://api.github.com/repos/test/test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/test/test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/test/test/teams", + "hooks_url": "https://api.github.com/repos/test/test/hooks", + "issue_events_url": "https://api.github.com/repos/test/test/issues/events{/number}", + "events_url": "https://api.github.com/repos/test/test/events", + "assignees_url": "https://api.github.com/repos/test/test/assignees{/user}", + "branches_url": "https://api.github.com/repos/test/test/branches{/branch}", + "tags_url": "https://api.github.com/repos/test/test/tags", + "blobs_url": "https://api.github.com/repos/test/test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/test/test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/test/test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/test/test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/test/test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/test/test/languages", + "stargazers_url": "https://api.github.com/repos/test/test/stargazers", + "contributors_url": "https://api.github.com/repos/test/test/contributors", + "subscribers_url": "https://api.github.com/repos/test/test/subscribers", + "subscription_url": "https://api.github.com/repos/test/test/subscription", + "commits_url": "https://api.github.com/repos/test/test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/test/test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/test/test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/test/test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/test/test/contents/{+path}", + "compare_url": "https://api.github.com/repos/test/test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/test/test/merges", + "archive_url": "https://api.github.com/repos/test/test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/test/test/downloads", + "issues_url": "https://api.github.com/repos/test/test/issues{/number}", + "pulls_url": "https://api.github.com/repos/test/test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/test/test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/test/test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/test/test/labels{/name}", + "releases_url": "https://api.github.com/repos/test/test/releases{/id}", + "created_at": "2015-10-22T15:09:18Z", + "updated_at": "2015-10-22T15:09:18Z", + "pushed_at": "2015-11-19T17:36:18Z", + "git_url": "git://github.com/test/test.git", + "ssh_url": "git@github.com:test/test.git", + "clone_url": "https://github.com/test/test.git", + "svn_url": "https://github.com/test/test", + "homepage": null, + "size": 11, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 1, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "test:master", + "ref": "master", + "sha": "adf0ba360203624fbcacaa6a8b55a89ae66e0120", + "user": { + "login": "test", + "id": 1234, + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/test", + "html_url": "https://github.com/test", + "followers_url": "https://api.github.com/users/test/followers", + "following_url": "https://api.github.com/users/test/following{/other_user}", + "gists_url": "https://api.github.com/users/test/gists{/gist_id}", + "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/test/subscriptions", + "organizations_url": "https://api.github.com/users/test/orgs", + "repos_url": "https://api.github.com/users/test/repos", + "events_url": "https://api.github.com/users/test/events{/privacy}", + "received_events_url": "https://api.github.com/users/test/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 44753409, + "name": "test", + "full_name": "test/test", + "owner": { + "login": "test", + "id": 1234, + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/test", + "html_url": "https://github.com/test", + "followers_url": "https://api.github.com/users/test/followers", + "following_url": "https://api.github.com/users/test/following{/other_user}", + "gists_url": "https://api.github.com/users/test/gists{/gist_id}", + "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/test/subscriptions", + "organizations_url": "https://api.github.com/users/test/orgs", + "repos_url": "https://api.github.com/users/test/repos", + "events_url": "https://api.github.com/users/test/events{/privacy}", + "received_events_url": "https://api.github.com/users/test/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/test/test", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/test/test", + "forks_url": "https://api.github.com/repos/test/test/forks", + "keys_url": "https://api.github.com/repos/test/test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/test/test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/test/test/teams", + "hooks_url": "https://api.github.com/repos/test/test/hooks", + "issue_events_url": "https://api.github.com/repos/test/test/issues/events{/number}", + "events_url": "https://api.github.com/repos/test/test/events", + "assignees_url": "https://api.github.com/repos/test/test/assignees{/user}", + "branches_url": "https://api.github.com/repos/test/test/branches{/branch}", + "tags_url": "https://api.github.com/repos/test/test/tags", + "blobs_url": "https://api.github.com/repos/test/test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/test/test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/test/test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/test/test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/test/test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/test/test/languages", + "stargazers_url": "https://api.github.com/repos/test/test/stargazers", + "contributors_url": "https://api.github.com/repos/test/test/contributors", + "subscribers_url": "https://api.github.com/repos/test/test/subscribers", + "subscription_url": "https://api.github.com/repos/test/test/subscription", + "commits_url": "https://api.github.com/repos/test/test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/test/test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/test/test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/test/test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/test/test/contents/{+path}", + "compare_url": "https://api.github.com/repos/test/test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/test/test/merges", + "archive_url": "https://api.github.com/repos/test/test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/test/test/downloads", + "issues_url": "https://api.github.com/repos/test/test/issues{/number}", + "pulls_url": "https://api.github.com/repos/test/test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/test/test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/test/test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/test/test/labels{/name}", + "releases_url": "https://api.github.com/repos/test/test/releases{/id}", + "created_at": "2015-10-22T15:09:18Z", + "updated_at": "2015-10-22T15:09:18Z", + "pushed_at": "2015-11-19T17:36:18Z", + "git_url": "git://github.com/test/test.git", + "ssh_url": "git@github.com:test/test.git", + "clone_url": "https://github.com/test/test.git", + "svn_url": "https://github.com/test/test", + "homepage": null, + "size": 11, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 1, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/test/test/pulls/1" + }, + "html": { + "href": "https://github.com/test/test/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/test/test/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/test/test/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/test/test/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/test/test/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/test/test/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/test/test/statuses/74e73762209d23d19e88f1ded82be30ede0e3d4b" + } + }, + "merged": false, + "mergeable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "commits": 1, + "additions": 6, + "deletions": 1, + "changed_files": 2 + }, + "repository": { + "id": 44753409, + "name": "test", + "full_name": "test/test", + "owner": { + "login": "test", + "id": 1234, + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/test", + "html_url": "https://github.com/test", + "followers_url": "https://api.github.com/users/test/followers", + "following_url": "https://api.github.com/users/test/following{/other_user}", + "gists_url": "https://api.github.com/users/test/gists{/gist_id}", + "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/test/subscriptions", + "organizations_url": "https://api.github.com/users/test/orgs", + "repos_url": "https://api.github.com/users/test/repos", + "events_url": "https://api.github.com/users/test/events{/privacy}", + "received_events_url": "https://api.github.com/users/test/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/test/test", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/test/test", + "forks_url": "https://api.github.com/repos/test/test/forks", + "keys_url": "https://api.github.com/repos/test/test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/test/test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/test/test/teams", + "hooks_url": "https://api.github.com/repos/test/test/hooks", + "issue_events_url": "https://api.github.com/repos/test/test/issues/events{/number}", + "events_url": "https://api.github.com/repos/test/test/events", + "assignees_url": "https://api.github.com/repos/test/test/assignees{/user}", + "branches_url": "https://api.github.com/repos/test/test/branches{/branch}", + "tags_url": "https://api.github.com/repos/test/test/tags", + "blobs_url": "https://api.github.com/repos/test/test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/test/test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/test/test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/test/test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/test/test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/test/test/languages", + "stargazers_url": "https://api.github.com/repos/test/test/stargazers", + "contributors_url": "https://api.github.com/repos/test/test/contributors", + "subscribers_url": "https://api.github.com/repos/test/test/subscribers", + "subscription_url": "https://api.github.com/repos/test/test/subscription", + "commits_url": "https://api.github.com/repos/test/test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/test/test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/test/test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/test/test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/test/test/contents/{+path}", + "compare_url": "https://api.github.com/repos/test/test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/test/test/merges", + "archive_url": "https://api.github.com/repos/test/test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/test/test/downloads", + "issues_url": "https://api.github.com/repos/test/test/issues{/number}", + "pulls_url": "https://api.github.com/repos/test/test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/test/test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/test/test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/test/test/labels{/name}", + "releases_url": "https://api.github.com/repos/test/test/releases{/id}", + "created_at": "2015-10-22T15:09:18Z", + "updated_at": "2015-10-22T15:09:18Z", + "pushed_at": "2015-11-19T17:36:18Z", + "git_url": "git://github.com/test/test.git", + "ssh_url": "git@github.com:test/test.git", + "clone_url": "https://github.com/test/test.git", + "svn_url": "https://github.com/test/test", + "homepage": null, + "size": 11, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 1, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "test", + "id": 1234, + "url": "https://api.github.com/orgs/test", + "repos_url": "https://api.github.com/orgs/test/repos", + "events_url": "https://api.github.com/orgs/test/events", + "members_url": "https://api.github.com/orgs/test/members{/member}", + "public_members_url": "https://api.github.com/orgs/test/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/1234?v=3", + "description": null + }, + "sender": { + "login": "a", + "id": 123, + "avatar_url": "https://avatars.githubusercontent.com/u/123?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/a", + "html_url": "https://github.com/a", + "followers_url": "https://api.github.com/users/a/followers", + "following_url": "https://api.github.com/users/a/following{/other_user}", + "gists_url": "https://api.github.com/users/a/gists{/gist_id}", + "starred_url": "https://api.github.com/users/a/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/a/subscriptions", + "organizations_url": "https://api.github.com/users/a/orgs", + "repos_url": "https://api.github.com/users/a/repos", + "events_url": "https://api.github.com/users/a/events{/privacy}", + "received_events_url": "https://api.github.com/users/a/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/src/test/resources/pull_request_from_the_same_repo.json b/src/test/resources/pull_request_synchronized.json similarity index 100% rename from src/test/resources/pull_request_from_the_same_repo.json rename to src/test/resources/pull_request_synchronized.json