Hudson 部署插件 - 多个 Tomcat 服务器

发布于 2024-12-15 21:31:35 字数 353 浏览 3 评论 0原文

我正在尝试做什么
有一项 hudson 作业要求用户选择 tomcat 服务器 ip 来部署 war 文件。

我做了什么
我创建了一个参数化的 hudson 作业“projectname-deploy”,要求用户选择要部署(开发、暂存、实时)war 文件的服务器。在 Hudson 的部署插件字段“Tomcat URL”中,我提供了 http://${SERVER}:8080/ -- SERVER 是包含服务器 IP 的参数字段。但是,${SERVER} 不会被用户选择的 IP 地址替换。

关于如何将战争部署到用户选择的 tomcat 服务器有什么建议吗?谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝戈者 2024-12-22 21:31:35

我最终使用curl命令来部署war而不是war插件——服务器名称是类型选择的构建作业参数,因此用户可以选择要部署构建的服务器。

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

我发现这个线程Tomcat管理器远程部署脚本很有帮助

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

-柠檬树下少年和吉他 2024-12-22 21:31:35

您可以为开发、登台和实时使用不同的配置文件,并根据下拉选择激活配置文件。

假设您在名为 ENVIRONMENT 的参数化作业中创建了一个选择,其中包含选择 dev、staging 等。然后您可以在 pom 中拥有像这样的配置文件...

<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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文