Package com.groupon.jenkins.dynamic.build

Examples of com.groupon.jenkins.dynamic.build.DbBackedBuild


    public <P extends DbBackedProject<P, B>, B extends DbBackedBuild<P, B>> MongoRunMap<P, B> getBuildsAsMap(DbBackedProject project) {
        return new MongoRunMap<P, B>(project);
    }

    public <T extends DbBackedBuild> T getFirstBuild(DbBackedProject project) {
        DbBackedBuild build =  getDatastore().createQuery(DbBackedBuild.class).
                limit(1).order("-number").
                get();

        associateProject(project, build);
View Full Code Here


    private Query<DbBackedBuild> getQuery(DbBackedProject project) {
        return getDatastore().createQuery(DbBackedBuild.class).disableValidation().field("projectId").equal(project.getId());
    }

    public <T extends DbBackedBuild> T getLastBuild(DbBackedProject project) {
        DbBackedBuild build =  getQuery(project).limit(1).order("-number").get();

        associateProject(project, build);

        return (T) build;
    }
View Full Code Here

        return (T) build;
    }

    public <T extends DbBackedBuild> T getLastFailedBuild(DbBackedProject project) {
        DbBackedBuild build =  getQuery(project).limit(1).order("-number").
                field("result").equal(Result.FAILURE.toString()).
                get();

        associateProject(project, build);
View Full Code Here

        return (T) build;
    }

    public <T extends DbBackedBuild> T getLastSuccessfulBuild(DbBackedProject project) {
        DbBackedBuild build =  getQuery(project).order("-number").
                field("result").equal(Result.SUCCESS.toString()).
                get();

        associateProject(project, build);
View Full Code Here

        return (T) build;
    }

    public <T extends DbBackedBuild> T getLastSuccessfulBuild(DbBackedProject project, String branch) {
        DbBackedBuild build =  getQuery(project).order("-number").
                field("result").equal(Result.SUCCESS.toString()).
                field("actions.causes.branch.branch").equal(branch).
                get();

        associateProject(project, build);
View Full Code Here

    public <T extends DbBackedBuild> boolean hasBuild(DbBackedBuild build) {
        return this.<T> getBuild((DbBackedProject) build.getProject(), build.getNumber()) != null;
    }

    public <T extends DbBackedBuild> T getBuild(DbBackedProject<?, ?> project, Integer number) {
        DbBackedBuild build =  getQuery(project).
                field("number").equal(number).
                get();

        associateProject(project, build);
View Full Code Here

        return (T) build;
    }

    public <T extends DbBackedBuild> T getBuildBySha(DbBackedProject<?, ?> project, String sha) {
        DbBackedBuild build =  getQuery(project).
            field("actions.causes.sha").equal(sha).
            get();

        associateProject(project, build);
View Full Code Here

    }

    public DbBackedBuild getPreviousFinishedBuildOfSameBranch(DbBackedBuild build, String branch) {
        DbBackedProject project = (DbBackedProject) build.getProject();

        DbBackedBuild previousBuild = getQuery(project).
                limit(1).
                order("-number").
                field("actions.causes.branch.branch").equal(branch).
                field("state").equal("COMPLETED").field("number").lessThan(build.getNumber()).
                get();
View Full Code Here

        return previousBuild;
    }

    public CurrentBuildState getCurrentStateByNumber(DbBackedProject project, int number) {
        DbBackedBuild build = getQuery(project).field("number").equal(number).get();
        if(build == null) {
            return null;
        } else {
            return new CurrentBuildState(build.getState(), build.getResult());
        }
    }
View Full Code Here

        return builds;
    }

    public <T extends DbBackedBuild> T getLastBuild(DbBackedProject project, String branch) {
        DbBackedBuild build = getQuery(project)
                .order("-number")
                .field("actions.causes.branch.branch").equal(branch).get();
        associateProject(project, build);
        return (T) build;
    }
View Full Code Here

TOP

Related Classes of com.groupon.jenkins.dynamic.build.DbBackedBuild

Copyright © 2018 www.massapicom. 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.