Reputation: 1041
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!
Upvotes: 1
Views: 3307
Reputation: 1041
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
Upvotes: 1
Reputation: 124209
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.
Upvotes: 0