Package hudson.model

Examples of hudson.model.Result


        final GitSCM gitSCM = (GitSCM) scm;

        final String projectName = build.getProject().getName();
        final FilePath workspacePath = build.getWorkspace();
        final int buildNumber = build.getNumber();
        final Result buildResult = build.getResult();

        // If pushOnlyIfSuccess is selected and the build is not a success, don't push.
        if (pushOnlyIfSuccess && buildResult.isWorseThan(Result.SUCCESS)) {
            listener.getLogger()
                .println(
                    "Build did not succeed and the project is configured to only push after a successful build, so no pushing will occur.");
            return true;
        } else {
            final String gitExe = gitSCM.getGitExe(build.getBuiltOn(), listener);
            EnvVars tempEnvironment;
            try {
                tempEnvironment = build.getEnvironment(listener);
            } catch (IOException e) {
                listener.error("IOException publishing in git plugin");
                tempEnvironment = new EnvVars();
            }

            String confName = gitSCM.getGitConfigNameToUse();
            if (StringUtils.isNotBlank(confName)) {
                tempEnvironment.put(GitConstants.GIT_COMMITTER_NAME_ENV_VAR, confName);
                tempEnvironment.put(GitConstants.GIT_AUTHOR_NAME_ENV_VAR, confName);
            }
            String confEmail = gitSCM.getGitConfigEmailToUse();
            if (StringUtils.isNotBlank(confEmail)) {
                tempEnvironment.put(GitConstants.GIT_COMMITTER_EMAIL_ENV_VAR, confEmail);
                tempEnvironment.put(GitConstants.GIT_AUTHOR_EMAIL_ENV_VAR, confEmail);
            }

            final EnvVars environment = tempEnvironment;
            final FilePath workingDirectory = gitSCM.workingDirectory(workspacePath);

            boolean pushResult = true;
            // If we're pushing the merge back...
            if (pushMerge) {
                boolean mergeResult;
                try {
                    mergeResult = workingDirectory.act(new FileCallable<Boolean>() {
                        private static final long serialVersionUID = 1L;

                        public Boolean invoke(File workspace,
                                              VirtualChannel channel) throws IOException {

                            IGitAPI git = new GitAPI(
                                gitExe, new FilePath(workspace),
                                listener, environment);
                            // We delete the old tag generated by the SCM plugin
                            String tagName = new StringBuilder()
                                .append(GitConstants.INTERNAL_TAG_NAME_PREFIX)
                                .append(GitConstants.HYPHEN_SYMBOL)
                                .append(projectName)
                                .append(GitConstants.HYPHEN_SYMBOL)
                                .append(buildNumber)
                                .toString();

                            git.deleteTag(tagName);

                            // And add the success / fail state into the tag.
                            tagName += "-" + buildResult.toString();

                            git.tag(tagName, GitConstants.INTERNAL_TAG_COMMENT_PREFIX + buildNumber);

                            PreBuildMergeOptions mergeOptions = gitSCM.getMergeOptions();

                            if (mergeOptions.doMerge() && buildResult.isBetterOrEqualTo(
                                Result.SUCCESS)) {
                                RemoteConfig remote = mergeOptions.getMergeRemote();
                                listener.getLogger().println(new StringBuilder().append("Pushing result ")
                                    .append(tagName)
                                    .append(" to ")
View Full Code Here


  private String createLinkUrl(AbstractBuild<?, ?> build) {
    return getDescriptor().getHudsonUrl() + build.getUrl();
  }

  private boolean isNewFailure(AbstractBuild<?, ?> build) {
    Result previousResult = build.getPreviousBuild() != null ? build.getPreviousBuild().getResult()
        : Result.SUCCESS;
    Result currentResult = build.getResult();
    return previousResult == Result.SUCCESS
        && (currentResult == Result.FAILURE || build.getResult() == Result.UNSTABLE);
  }
View Full Code Here

    return previousResult == Result.SUCCESS
        && (currentResult == Result.FAILURE || build.getResult() == Result.UNSTABLE);
  }

  private boolean isRecovery(AbstractBuild<?, ?> build) {
    Result previousResult = build.getPreviousBuild() != null ? build.getPreviousBuild().getResult()
        : Result.SUCCESS;
    Result currentResult = build.getResult();
    return currentResult == Result.SUCCESS
        && (previousResult == Result.FAILURE || build.getPreviousBuild().getResult() == Result.UNSTABLE);
  }
View Full Code Here

  public void setEnvVar(String envVar) {
    this.envVar = envVar;
  }

  public String isSkipSonar(AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException {
    Result result = build.getResult();

    if (result != null && result.isWorseThan(Result.UNSTABLE)) {
      // skip analysis if build failed
      // unstable means that build completed, but there were some test failures, which is not critical for analysis
      return Messages.SonarPublisher_BadBuildStatus(build.getResult().toString());
    }
View Full Code Here

        context.put("PROJECT_FULL_NAME", build.getProject().getFullName());
        context.put("PROJECT_FULL_DISPLAY_NAME", build.getProject().getFullDisplayName());

        context.put("BUILD_DISPLAY_NAME", build.getDisplayName());

        Result result = build.getResult();
        String resultString = result.toString();
        context.put("RESULT", resultString);
        if (!smartNotify && result == Result.SUCCESS) {
            context.put("SMART_RESULT", resultString.toLowerCase());
        } else {
            context.put("SMART_RESULT", resultString);
View Full Code Here

            if (debug)
                listener.getLogger().println("Reporters=" + reporters);
            if (!preBuild(listener, reporters))
                return FAILURE;

            Result r = null;
            try {
                List<BuildWrapper> wrappers = new ArrayList<BuildWrapper>(getProject().getBuildWrappersList().toList());

                ParametersAction parameters = getAction(ParametersAction.class);
                if (parameters != null)
View Full Code Here

     * More precisely, this picks up the status of this build itself, plus all
     * the latest builds of the modules that belongs to this build.
     */
    @Override
    public Result getResult() {
        Result r = super.getResult();

        for (IvyBuild b : getModuleLastBuilds().values()) {
            Result br = b.getResult();
            if (r == null)
                r = br;
            else if (br == Result.NOT_BUILT)
                continue; // UGLY: when computing combined status, ignore the
            // modules that were not built
View Full Code Here

            return false;
        }
       
        AbstractBuild<?, ?> previousBuild = getPreviousNonAbortedBuild(build);
        if (previousBuild != null) {
            Result previousResult = previousBuild.getResult();
      return previousResult != null && previousResult.isWorseThan(Result.SUCCESS);
        }
        return false;
    }
View Full Code Here

   
    /**
     * Returns the extended result description of a build.
     */
    public static ExtResult getExtendedResult(AbstractBuild<?, ?> build) {
        Result result = build.getResult();
       
        if (result == Result.ABORTED) {
            return ExtResult.ABORTED;
        } else if (result == Result.NOT_BUILT) {
            return ExtResult.NOT_BUILT;
View Full Code Here

                    Outcome o = t.runNextChunk();
                    if (o.isFailure()) {
                        assert !t.isAlive();    // failed thread is non-resumable

                        // workflow produced an exception
                        Result result = Result.FAILURE;
                        Throwable error = o.getAbnormal();
                        if (error instanceof FlowInterruptedException) {
                            result = ((FlowInterruptedException) error).getResult();
                        }
                        execution.setResult(result);
View Full Code Here

TOP

Related Classes of hudson.model.Result

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.