Examples of GitBranch


Examples of com.groupon.jenkins.github.GitBranch

        DynamicBuild dynamicBuild = DynamicBuildFactory.newBuild().manualStart("surya", "master").get();
        GithubRepositoryService githubRepositoryService = mock(GithubRepositoryService.class);
        when(githubRepositoryService.getShaForBranch("master")).thenReturn("masterSha");
        DynamicBuildModel model = new DynamicBuildModel(dynamicBuild, githubRepositoryService);
        model.run();
        verify(dynamicBuild).addCause(new ManualBuildCause(new GitBranch("master"), "masterSha", "surya"));
    }
View Full Code Here

Examples of com.groupon.jenkins.github.GitBranch

    public GHContent getGHFile(String fileName, String sha) throws IOException {
        return getGithubRepository().getFileContent(fileName, sha);
    }

    public String getShaForBranch(String branch) {
        GitBranch gitBranch = new GitBranch(branch);
        if (gitBranch.isPullRequest()) {
            try {
                return getGithubRepository().getPullRequest(gitBranch.pullRequestNumber()).getHead().getSha();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        } else {
            try {
                GHRef ref = getRef("heads/" + gitBranch);
                return ref.getObject().getSha();
            } catch (IOException e) {
                return gitBranch.toString();
            }
        }
    }
View Full Code Here

Examples of com.groupon.jenkins.github.GitBranch

    private void addBuildCauseForNonGithubCauses() {
        if (build.getCause(UserIdCause.class) != null) {
            String user = build.getCause(UserIdCause.class).getUserId();
            String branch = build.getEnvVars().get("BRANCH");
            String sha = githubRepositoryService.getShaForBranch(branch);
            ManualBuildCause manualCause = new ManualBuildCause(new GitBranch(branch), sha, user);
            build.addCause(manualCause);
        }
        if (build.getCause() == BuildCause.NULL_BUILD_CAUSE) {
            String branch = build.getEnvVars().get("BRANCH");
            String sha = githubRepositoryService.getShaForBranch(branch);
            build.addCause(new UnknownBuildCause(new GitBranch(branch), sha));
        }
    }
View Full Code Here

Examples of com.groupon.jenkins.github.GitBranch

    public GithubCause(Payload payload, String sha) {
        this.buildDescription = payload.getBuildDescription();
        this.pusher = payload.getPusher();
        this.pullRequestNumber = payload.isPullRequest() ? payload.getPullRequestNumber() : null;
        this.sha = sha;
        this.branch = new GitBranch(payload.getBranch());
        this.logEntries = payload.getLogEntries();
    }
View Full Code Here

Examples of com.groupon.jenkins.github.GitBranch

        return "";
    }

    @Override
    public GitBranch getBranch() {
        return new GitBranch("undetermined");
    }
View Full Code Here

Examples of playRepository.GitBranch

    @IsAllowed(Operation.READ)
    public static Result branches(String loginId, String projectName) throws IOException, GitAPIException {
        Project project = Project.findByOwnerAndProjectName(loginId, projectName);
        GitRepository gitRepository = new GitRepository(project);
        List<GitBranch> allBranches = gitRepository.getAllBranches();
        final GitBranch headBranch = gitRepository.getHeadBranch();

        // filter the head branch from all branch list.
        CollectionUtils.filter(allBranches, new Predicate() {
            @Override
            public boolean evaluate(Object o) {
                GitBranch gitBranch = (GitBranch)o;
                return !gitBranch.getName().equals(headBranch.getName());
            }
        });

        return ok(branches.render(project, allBranches, headBranch));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.