Ejemplo n.º 1
0
 public String getBuildServerUrl() {
   if (buildServerUrl == null || buildServerUrl == "") {
     JenkinsLocationConfiguration jenkinsConfig = new JenkinsLocationConfiguration();
     return jenkinsConfig.getUrl();
   } else {
     return buildServerUrl;
   }
 }
Ejemplo n.º 2
0
 @Override
 public boolean configure(StaplerRequest sr, JSONObject formData) throws FormException {
   teamDomain = sr.getParameter("slackTeamDomain");
   token = sr.getParameter("slackToken");
   room = sr.getParameter("slackRoom");
   buildServerUrl = sr.getParameter("slackBuildServerUrl");
   sendAs = sr.getParameter("slackSendAs");
   if (buildServerUrl == null || buildServerUrl == "") {
     JenkinsLocationConfiguration jenkinsConfig = new JenkinsLocationConfiguration();
     buildServerUrl = jenkinsConfig.getUrl();
   }
   if (buildServerUrl != null && !buildServerUrl.endsWith("/")) {
     buildServerUrl = buildServerUrl + "/";
   }
   save();
   return super.configure(sr, formData);
 }
Ejemplo n.º 3
0
 private Collection<String> getDockerRunCommand(ECSSlave slave) {
   Collection<String> command = new ArrayList<String>();
   command.add("-url");
   command.add(JenkinsLocationConfiguration.get().getUrl());
   if (StringUtils.isNotBlank(tunnel)) {
     command.add("-tunnel");
     command.add(tunnel);
   }
   command.add(slave.getComputer().getJnlpMac());
   command.add(slave.getComputer().getName());
   return command;
 }
Ejemplo n.º 4
0
  public static void sendMail(String[] addresses, String subject, String message)
      throws UnsupportedEncodingException, MessagingException {

    MimeMessage mimeMessage = new MimeMessage(Mailer.descriptor().createSession());
    String adminAddress = JenkinsLocationConfiguration.get().getAdminAddress();

    InternetAddress[] to = new InternetAddress[addresses.length];
    for (int i = 0; i < addresses.length; i++) {
      to[i] = new InternetAddress(addresses[i], true);
    }
    mimeMessage.setSender(new InternetAddress(adminAddress));
    mimeMessage.setRecipients(Message.RecipientType.TO, to);
    mimeMessage.setSubject(subject, "ISO-2022-JP");
    mimeMessage.setText(message, "ISO-2022-JP");
    Transport.send(mimeMessage);
  }