Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ private MessageBuilder startMessage() {
}

public MessageBuilder appendOpenLink() {
AbstractProject<?, ?> project = build.getProject();
HipChatNotifier.HipChatJobProperty jobProperty = project.getProperty(HipChatNotifier.HipChatJobProperty.class);
String url = notifier.getBuildServerUrl() + build.getUrl();
if (jobProperty.getConsoleLink()) url += "console";
message.append(" (<a href='").append(url).append("'>Open</a>)");
return this;
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/jenkins/plugins/hipchat/HipChatNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public String getDisplayName() {

public static class HipChatJobProperty extends hudson.model.JobProperty<AbstractProject<?, ?>> {
private String room;
private boolean consoleLink;
private boolean startNotification;
private boolean notifySuccess;
private boolean notifyAborted;
Expand All @@ -148,6 +149,7 @@ public static class HipChatJobProperty extends hudson.model.JobProperty<Abstract

@DataBoundConstructor
public HipChatJobProperty(String room,
boolean consoleLink,
boolean startNotification,
boolean notifyAborted,
boolean notifyFailure,
Expand All @@ -156,6 +158,7 @@ public HipChatJobProperty(String room,
boolean notifyUnstable,
boolean notifyBackToNormal) {
this.room = room;
this.consoleLink = consoleLink;
this.startNotification = startNotification;
this.notifyAborted = notifyAborted;
this.notifyFailure = notifyFailure;
Expand All @@ -170,6 +173,11 @@ public String getRoom() {
return room;
}

@Exported
public boolean getConsoleLink() {
return consoleLink;
}

@Exported
public boolean getStartNotification() {
return startNotification;
Expand Down Expand Up @@ -233,6 +241,7 @@ public boolean isApplicable(Class<? extends Job> jobType) {
@Override
public HipChatJobProperty newInstance(StaplerRequest sr, JSONObject formData) throws hudson.model.Descriptor.FormException {
return new HipChatJobProperty(sr.getParameter("hipChatProjectRoom"),
sr.getParameter("hipChatConsoleLink") != null,
sr.getParameter("hipChatStartNotification") != null,
sr.getParameter("hipChatNotifyAborted") != null,
sr.getParameter("hipChatNotifyFailure") != null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<f:textbox name="hipChatProjectRoom" value="${instance.getRoom()}"/>
</f:entry>

<f:entry title="Link to console">
<f:checkbox name="hipChatConsoleLink" value="true" checked="${instance.getConsoleLink()}"/>
</f:entry>

<f:entry title="Notify Build Start">
<f:checkbox name="hipChatStartNotification" value="true" checked="${instance.getStartNotification()}"/>
</f:entry>
Expand Down