1

What I am trying to do:
Have one hudson job that asks the user to select the tomcat server ip to deploy the war file.

What I have done:
I created a parameterized hudson job "projectname-deploy" that asks the user to select the server to deploy (dev, staging, live) the war file. In Hudson's deploy plugin field "Tomcat URL" I provided http://${SERVER}:8080/ -- SERVER is the parameter field that contains server IP. However, ${SERVER} is not getting replaced with the ip address the user selected.

Any suggestions on how to get a war deployed to the user selected tomcat server? thanks!

sbi
  • 219,715
  • 46
  • 258
  • 445
dsatish
  • 1,041
  • 15
  • 27

2 Answers2

1

I ended up using the curl command to deploy the war instead of the war plugin-- server name is build job parameter of type choice, so user can choose what server to deploy the build.

curl --upload-file <path to warfile> "http://<tomcat username>:<tomcat password>@<hostname>:<port>/manager/deploy?path=/<context>&update=true"

I found this thread Tomcat manager remote deploy script helpful

Community
  • 1
  • 1
dsatish
  • 1,041
  • 15
  • 27
0

You could use different profiles for dev, staging and live and activate the profile based on the dropdown selection.

Lets say you had create a choice in the parameterized job called ENVIRONMENT with the choices dev, staging etc. Then you could have profiles in the pom like this...

<profile>
  <id>dev/id>
  <activation>
    <property>
      <name>env.ENVIRONMENT</name>
      <value>dev</value>
    </property>
  </activation>
  <properties>
    <tomcat.url>http://whatever-you-need-here:8080</tomcat.url>
  </properties>
</profile>
<profile>
  repeat with different activations for staging etc.
</profile>

you can then use the property as you wish to deploy to where you need to.

Robert Longson
  • 118,664
  • 26
  • 252
  • 242
  • I don't want to do it via profiles-- mainly because I don't want to enter server hostname details in the pom file – dsatish Nov 23 '11 at 03:07