简体   繁体   English

使用相同的jenkins作业在不同的服务器中部署不同的应用程序

[英]Using same jenkins job for deployment of different applications in different servers

I have six separate deployment jobs in jenkins for deploying two different applications in three different servers. 我在jenkins中有六个单独的部署作业,用于在三个不同的服务器中部署两个不同的应用程序。 Listed below are the job names. 下面列出的是工作名称。

  1. deploy ProductApplication1 dev 部署ProductApplication1 dev

  2. deploy ProductApplication1 ppe 部署ProductApplication1 ppe

  3. deploy productApplication1 prod 部署productApplication1产品

  4. deploy ProductApplication2 dev 部署ProductApplication2开发

  5. deploy ProductApplication2 ppe 部署ProductApplication2 ppe

  6. deploy productApplication2 prod 部署productApplication2产品

In each of the jenkin job above, I could see a similar build configuration as below. 在上面的每个詹金工作中,我可以看到如下类似的构建配置。 As I am using jenkins for the first time I cannot really understand the shell commands written. 当我第一次使用jenkins时,我无法真正理解所编写的shell命令。

在此处输入图片说明

I would like to create a single job which could accept the environment(dev/ppe/prod) as a parameter and deploy accordingly. 我想创建一个可以接受环境(dev / ppe / prod)作为参数并进行相应部署的作业。

What are the steps that are required to be followed for achieving this. 实现此目标需要遵循哪些步骤。 Requesting you to explain on what changes that would be required on .yml or ansible scripts files too. 请您说明.yml或ansible脚本文件也需要进行哪些更改。

This sounds like it can be solved with a simple parameterized build. 听起来可以通过简单的参数化构建来解决。

See https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build for details 有关详细信息,请参见https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

Then define 2 parameters for your jobs. 然后为您的工作定义2个参数。 Then replace occurrences of the values to the parameter variable (eg $APPLICATION and $SERVER) 然后将出现的值替换为参数变量(例如$ APPLICATION和$ SERVER)

For more details in the suggestion, you would have to expose the current solution in more detail. 有关建议中的更多详细信息,您将必须更详细地介绍当前解决方案。

Best solution would be just one job using a multi-configuration job. 最佳解决方案将是使用多配置作业的一项作业。 you can provide the applications and servers as axis... 您可以提供应用程序和服务器作为轴...

https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin

even you can label the servers and restrict on which slaves it has to run.. 甚至您都可以标记服务器并限制其必须运行的从站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 hibernate 在不同的应用程序上更新同一个表 - Updating the same table on the different applications using hibernate 同一个数据库的不同应用 - Different applications to the same database 使用具有intern()的不同端口运行2个Tomcat服务器会锁定相同的ID或否? - Running 2 Tomcat Servers using different ports with intern() will lock same id or no? 在不同服务器上的Web应用程序之间实现SSO,而无需更改现有应用程序 - Implementing SSO between webapplications on different servers without changes on existing applications 如何调试在两个不同的 Tomcat 服务器上运行的两个应用程序? - How to debug two applications running in two different Tomcat servers? 如何在不同的Java应用程序服务器上模拟/测试部署? - How can I simulate / test deployment on different Java Application Servers? 通过抽搐在不同服务器上部署两个相同版本的jar - Deploying two different versions of same jars through jenkings on different servers 在同一服务器上但在不同应用程序上调用Servlet? - Calling Servlets on same server but different applications? 在同一台计算机上为不同的应用程序运行多个jvm - Running multiple jvms for different applications in same machine 不同的Java应用程序可以使用相同的javaagent吗? - Can different Java applications use the same javaagent?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM