Skip to content
Browse files

Build against served version of modularized-build-pipeline-view plugin.

Also, create global config for the deployinator server.
  • Loading branch information...
1 parent 374f70a commit e30b571b66b3aaa6a906ddcd474506eb6bec2a90 Laura Beth Lincoln committed
View
6 pom.xml
@@ -14,6 +14,10 @@
<repositories>
<repository>
+ <id>elblinkin-mvn-repo</id>
+ <url>https://github.com/elblinkin/mvn-repo/raw/master/snapshots/</url>
+ </repository>
+ <repository>
<id>m.g.o-public</id>
<url>http://maven.glassfish.org/content/groups/public/</url>
</repository>
@@ -33,7 +37,7 @@
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
- <artifactId>build-pipeline-plugin</artifactId>
+ <artifactId>modularized-build-pipeline-plugin</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
View
5 src/main/java/com/etsy/jenkins/DeployinatorPipelineView.java
@@ -39,7 +39,10 @@ public void doManualExecution(
getJob(req.getParameter("triggerProjectName"));
if (isRestricted(triggerProject)) {
try {
- res.sendRedirect2("http://deployinator.etsycorp.com");
+ String serverAddress = Hudson.getInstance()
+ .getPlugin(DeployinatorPlugin.class)
+ .getDeployinatorServerToUse();
+ res.sendRedirect2(serverAddress);
} catch (IOException e) {
throw new RuntimeException(e);
}
View
66 src/main/java/com/etsy/jenkins/DeployinatorPlugin.java
@@ -1,14 +1,78 @@
package com.etsy.jenkins;
+import hudson.Extension;
import hudson.Plugin;
+import hudson.model.Describable;
+import hudson.model.Descriptor;
+import hudson.model.Descriptor.FormException;
import hudson.util.PluginServletFilter;
-public class DeployinatorPlugin extends Plugin {
+import net.sf.json.JSONObject;
+
+import org.kohsuke.stapler.StaplerRequest;
+
+public class DeployinatorPlugin
+extends Plugin
+implements Describable<DeployinatorPlugin> {
+
+ private String deployinatorServer;
+
+ public String getDeployinatorServer() {
+ return deployinatorServer;
+ }
+
+ public void setDeployinatorServer(String deployinatorServer) {
+ this.deployinatorServer = deployinatorServer;
+ }
+
+ public String getDeployinatorServerToUse() {
+ if (deployinatorServer == null) {
+ return ((DescriptorImpl) getDescriptor()).getDeployinatorServer();
+ }
+ return deployinatorServer;
+ }
@Override
public void start() throws Exception {
super.start();
PluginServletFilter.addFilter(new DeployinatorRestrictJobFilter());
}
+
+ public DescriptorImpl getDescriptor() {
+ return DESCRIPTOR;
+ }
+
+ @Extension
+ public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();
+ public static final class DescriptorImpl
+ extends Descriptor<DeployinatorPlugin> {
+
+ String deployinatorServer;
+
+ public DescriptorImpl() {
+ super(DeployinatorPlugin.class);
+ load();
+ }
+
+ public String getDisplayName() {
+ return "Deployinator";
+ }
+
+ public String getDeployinatorServer() {
+ return deployinatorServer;
+ }
+
+ public void setDeployinatorServer(String deployinatorServer) {
+ this.deployinatorServer = deployinatorServer;
+ }
+
+ @Override
+ public boolean configure(StaplerRequest req, JSONObject formData)
+ throws FormException {
+ deployinatorServer = req.getParameter("deployinator_plugin.deployinatorServer");
+ save();
+ return super.configure(req, formData);
+ }
+ }
}
View
5 src/main/java/com/etsy/jenkins/DeployinatorRestrictJobFilter.java
@@ -42,8 +42,9 @@ public void doFilter(
= (DeployinatorRestrictJobProperty)
project.getProperty(DeployinatorRestrictJobProperty.class);
if ((property != null) && property.isEnabled()) {
- // TODO Make a global setting for the Deployinator
- httpRes.sendRedirect("http://deployinator.etsycorp.com");
+ String serverAddress = HUDSON.getPlugin(DeployinatorPlugin.class)
+ .getDeployinatorServerToUse();
+ httpRes.sendRedirect(serverAddress);
return;
}
}
View
8 src/main/java/com/etsy/jenkins/cli/DeployinatorCommand.java
@@ -1,5 +1,6 @@
package com.etsy.jenkins.cli;
+import com.etsy.jenkins.DeployinatorPlugin;
import com.etsy.jenkins.cli.handlers.ProxyUserOptionHandler;
import hudson.AbortException;
@@ -262,9 +263,12 @@ public String getNewRevision() {
@Exported(visibility=3)
public String getDeployinatorDiffUrl() {
- // TODO Add a global config var for deployinator host
+ String serverAddress = Hudson.getInstance()
+ .getPlugin(DeployinatorPlugin.class)
+ .getDeployinatorServerToUse();
return String.format(
- "http://deployinator.etsycorp.com/diff/%s/%s/%s",
+ "%s/diff/%s/%s/%s",
+ serverAddress,
this.deployType,
this.oldRevision,
this.newRevision);
View
8 src/main/resources/com/etsy/jenkins/DeployinatorPlugin/global.jelly
@@ -0,0 +1,8 @@
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
+ xmlns:t="/lib/hudson" xmlns:f="/lib/form">
+ <f:section title="Deployinator plugin">
+ <f:entry title="Deployinator Server Address">
+ <f:textbox name="deployinator_plugin.deployinatorServer" value="${descriptor.getDeployinatorServer()}"/>
+ </f:entry>
+ </f:section>
+</j:jelly>

0 comments on commit e30b571

Please sign in to comment.
Something went wrong with that request. Please try again.