Permalink
Browse files

Added context path.

  • Loading branch information...
2 parents 5d428c1 + bf4c558 commit 5b49f418752da1149a7b4621558e9ca4ee29cc48 @mirkozt mirkozt committed May 9, 2012
View
@@ -1,6 +1,9 @@
********************************************
LiveRebel Deploy Plugin Changelog
********************************************
+1.01 (9th of May 2012)
+* Added context path option
+
1.0 (27th of February 2012)
* Added hotpatch support
* Added deploy support
View
24 pom.xml
@@ -69,21 +69,21 @@
</build>
<scm>
- <connection>scm:git:git://github.com/toomasr/liverebel-deploy-plugin.git</connection>
- <developerConnection>scm:git:git@github.com:toomasr/liverebel-deploy-plugin.git</developerConnection>
- <url>http://github.com/toomasr/liverebel-deploy-plugin</url>
+ <connection>scm:git:git://github.com/zeroturnaround/hudson-liverebel-plugin.git</connection>
+ <developerConnection>scm:git:git@github.com:zeroturnaround/hudson-liverebel-plugin.git</developerConnection>
+ <url>http://github.com/zeroturnaround/hudson-liverebel-plugin</url>
</scm>
<dependencies>
<dependency>
<groupId>com.zeroturnaround</groupId>
<artifactId>lr-api</artifactId>
- <version>2.0</version>
+ <version>2.0.8</version>
</dependency>
<dependency>
<groupId>com.zeroturnaround</groupId>
<artifactId>lr-util</artifactId>
- <version>1.8</version>
+ <version>1.16</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
@@ -135,18 +135,8 @@
<!-- get every artifact through maven.glassfish.org, which proxies all the artifacts that we need -->
<repositories>
<repository>
- <id>zt-releases</id>
- <url>dav:http://repos.zeroturnaround.com/nexus/content/repositories/zt-releases</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>zt-snapshots</id>
- <url>dav:http://repos.zeroturnaround.com/nexus/content/repositories/zt-snapshots</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
+ <id>zt-public</id>
+ <url>http://repos.zeroturnaround.com/nexus/content/repositories/zt-public</url>
</repository>
<repository>
<id>jmockit-svn</id>
@@ -65,12 +65,14 @@
public final String artifacts;
public final boolean useFallbackIfCompatibleWithWarnings;
public final Strategy strategy;
+ public final String contextPath;
private final List<ServerCheckbox> servers;
// Fields in config.jelly must match the parameter names in the
// "DataBoundConstructor"
@DataBoundConstructor
- public LiveRebelDeployPublisher(String artifacts, List<ServerCheckbox> servers, String strategy, boolean useFallbackIfCompatibleWithWarnings) {
+ public LiveRebelDeployPublisher(String artifacts, String contextPath, List<ServerCheckbox> servers, String strategy, boolean useFallbackIfCompatibleWithWarnings) {
+ this.contextPath = contextPath;
this.artifacts = artifacts;
this.strategy = Strategy.valueOf(strategy);
this.servers = servers;
@@ -95,7 +97,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
CommandCenterFactory commandCenterFactory = new CommandCenterFactory().setUrl(getDescriptor().getLrUrl()).setVerbose(true).authenticate(getDescriptor().getAuthToken());
- if (!new LiveRebelProxy(commandCenterFactory, listener).perform(deployableFiles, getDeployableServers(),
+ if (!new LiveRebelProxy(commandCenterFactory, listener).perform(deployableFiles, contextPath, getDeployableServers(),
strategy, useFallbackIfCompatibleWithWarnings))
build.setResult(Result.FAILURE);
return true;
@@ -1,20 +1,22 @@
package org.zeroturnaround.jenkins;
-/*****************************************************************
-Copyright 2011 ZeroTurnaround OÜ
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
- *****************************************************************/
+/**
+ * ***************************************************************
+ * Copyright 2011 ZeroTurnaround OÜ
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ ****************************************************************
+ */
import hudson.FilePath;
import hudson.model.BuildListener;
import java.io.File;
@@ -61,7 +63,7 @@ public LiveRebelProxy(CommandCenterFactory centerFactory, BuildListener listener
this.listener = listener;
}
- public boolean perform(FilePath[] wars, List<String> deployableServers, Strategy strategy, boolean useFallbackIfCompatibleWithWarnings) throws IOException, InterruptedException {
+ public boolean perform(FilePath[] wars, String contextPath, List<String> deployableServers, Strategy strategy, boolean useFallbackIfCompatibleWithWarnings) throws IOException, InterruptedException {
if (wars.length == 0) {
listener.getLogger().println("Could not find any artifact to deploy. Please, specify it in job configuration.");
return false;
@@ -87,7 +89,7 @@ public boolean perform(FilePath[] wars, List<String> deployableServers, Strategy
LiveRebelXml lrXml = getLiveRebelXml(warFile);
ApplicationInfo applicationInfo = getCommandCenter().getApplication(lrXml.getApplicationId());
uploadIfNeeded(applicationInfo, lrXml.getVersionId(), warFile);
- update(lrXml, applicationInfo, warFile, deployableServers);
+ update(lrXml, applicationInfo, warFile, deployableServers, contextPath);
listener.getLogger().printf(ARTIFACT_DEPLOYED_AND_UPDATED, deployableServers, warFile);
result = true;
}
@@ -159,13 +161,13 @@ boolean isFirstRelease(ApplicationInfo applicationInfo) {
return applicationInfo == null;
}
- void update(LiveRebelXml lrXml, ApplicationInfo applicationInfo, FilePath warFile, List<String> selectedServers) throws IOException,
+ void update(LiveRebelXml lrXml, ApplicationInfo applicationInfo, FilePath warFile, List<String> selectedServers, String contextPath) throws IOException,
InterruptedException {
listener.getLogger().println("Starting updating application on servers:");
Set<String> deployServers = getDeployServers(applicationInfo, selectedServers);
if (!deployServers.isEmpty()) {
- deploy(lrXml, warFile, deployServers);
+ deploy(lrXml, warFile, deployServers, contextPath);
}
if (deployServers.size() != selectedServers.size()) {
@@ -178,9 +180,11 @@ void update(LiveRebelXml lrXml, ApplicationInfo applicationInfo, FilePath warFil
}
}
- void deploy(LiveRebelXml lrXml, FilePath warfile, Set<String> serverIds) {
+ void deploy(LiveRebelXml lrXml, FilePath warfile, Set<String> serverIds, String contextPath) {
listener.getLogger().printf("Deploying new application on %s.\n", serverIds);
- getCommandCenter().deploy(lrXml.getApplicationId(), lrXml.getVersionId(), null, serverIds);
+ if (contextPath == null || contextPath.equals(""))
+ contextPath = null;
+ getCommandCenter().deploy(lrXml.getApplicationId(), lrXml.getVersionId(), contextPath, serverIds);
listener.getLogger().printf("SUCCESS: Application deployed to %s.\n", serverIds);
}
@@ -277,7 +281,7 @@ private Level getMaxDifferenceLevel(ApplicationInfo applicationInfo, LiveRebelXm
serversToUpdate.remove(server);
listener.getLogger().println(
"Server " + server + " already contains active version " + lrXml.getVersionId() + " of application "
- + lrXml.getApplicationId());
+ + lrXml.getApplicationId());
}
else {
DiffResult differences = getDifferences(lrXml, versionInServer);
@@ -304,4 +308,4 @@ private Level getMaxDifferenceLevel(ApplicationInfo applicationInfo, LiveRebelXm
public CommandCenter getCommandCenter() {
return commandCenter;
}
-}
+}
@@ -7,6 +7,10 @@
<f:entry title="Artifacts" field="artifacts">
<f:textbox />
</f:entry>
+
+ <f:entry title="Context path" field="contextPath">
+ <f:textbox />
+ </f:entry>
<f:entry field="useFallbackIfCompatibleWithWarnings">
<f:checkbox name="useFallbackIfCompatibleWithWarnings" checked="${instance.useFallbackIfCompatibleWithWarnings}"/>

0 comments on commit 5b49f41

Please sign in to comment.