[英]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. 下面列出的是工作名称。
deploy ProductApplication1 dev 部署ProductApplication1 dev
deploy ProductApplication1 ppe 部署ProductApplication1 ppe
deploy productApplication1 prod 部署productApplication1产品
deploy ProductApplication2 dev 部署ProductApplication2开发
deploy ProductApplication2 ppe 部署ProductApplication2 ppe
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.