示例#1
0
 private MessageBuilder startMessage() {
   message.append(this.escape(build.getProject().getDisplayName()));
   message.append(" - ");
   message.append(this.escape(build.getDisplayName()));
   message.append(" ");
   return this;
 }
示例#2
0
  /**
   * **************************************************
   *
   * <p>private int joinWithPossibleTimeout(ProcStarter proc, final TaskListener listener,
   * StringBuffer strBuf, AbstractBuild currentBuild) throws IOException, InterruptedException
   *
   * <p>**************************************************
   */
  protected int joinWithPossibleTimeout(
      ProcStarter proc,
      final TaskListener listener,
      StringBuffer strBuf,
      AbstractBuild currentBuild,
      String stringToHide)
      throws IOException, InterruptedException {
    boolean useTimeout = configuration.isUseTimeout();
    long timeoutValue = configuration.getTimeoutValue();

    int result = -1;

    try {
      PipedInputStream pis = null;
      if (strBuf != null) {
        PipedOutputStream pos = new PipedOutputStream();
        pis = new PipedInputStream(pos, 1000000);
        proc = proc.stdout(pos);
      }

      hudson.Proc procStarted = proc.start();
      if (useTimeout) {
        result = procStarted.joinWithTimeout(timeoutValue, TimeUnit.SECONDS, listener);
      } else {
        result = procStarted.join();
      }

      if (strBuf != null) {
        byte[] stdoutDataArr = new byte[pis.available()];
        pis.read(stdoutDataArr, 0, stdoutDataArr.length);
        String stdoutStr = new String(stdoutDataArr);
        if (stringToHide != null) {
          stdoutStr = stdoutStr.replaceAll(stringToHide, "****");
        }
        strBuf.append(stdoutStr);
        PrintStream output = listener.getLogger();
        output.println(stdoutStr);
      }
    } catch (InterruptedException e) {
      throw e;
    } catch (Exception e) {
      if (listener != null) {
        listener.error("Exception caught in joinWithPossibleTimeout: " + e);
      }
    }

    return result;
  } // End: joinWithPossibleTimeout(...)
示例#3
0
 public MessageBuilder appendDuration() {
   message.append(" after ");
   message.append(build.getDurationString());
   return this;
 }
示例#4
0
 public MessageBuilder appendOpenLink() {
   String url = notifier.getBuildServerUrl() + build.getUrl();
   message.append(" (<").append(url).append("|Open>)");
   return this;
 }
示例#5
0
 public MessageBuilder append(Object string) {
   message.append(this.escape(string.toString()));
   return this;
 }
示例#6
0
 public MessageBuilder append(String string) {
   message.append(this.escape(string));
   return this;
 }
示例#7
0
 public MessageBuilder appendStatusMessage() {
   message.append(this.escape(getStatusMessage(build)));
   return this;
 }