REST API /所需的任何其他解决方案:从Artifactory到Jenkins在app服务器上部署工件

时间:2021-05-19 23:08:15

I am DevOps beginner, experimenting over the AWS server to learn.

我是DevOps初学者,通过AWS服务器进行实验来学习。

I have created a job in Jenkins which run whenever any new push comes to my GITHUB, Maven build the code from GITHUB and archive the WAR file in Artifactory.

我在Jenkins中创建了一个作业,只要有任何新的推送到我的GITHUB,Maven就会从GITHUB构建代码并将WAR文件存档在Artifactory中。

I want to take next step now in which, the build artifact would be taken from Artifacotry and need to deploy on my App server.

我想现在采取下一步,其中构建工件将从Artifacotry获取并需要在我的App服务器上部署。

I look for solution and could not find any good explanation on this.

我寻找解决方案,但没有找到任何好的解释。

Can anyone share the steps/solution to do this?

任何人都可以分享这些步骤/解决方案吗?

Thanks in advance!

提前致谢!

2 个解决方案

#1


3  

The easiest way to achieve this is by creating an additional job Jenkins, which is responsible for downloading the artifacts of a specific build from Artifactory and deploying them to your Application Server. I recommend using the Pipeline DSL for Artifactory or a Free-Style job with the Generic Artifactory Integration, because both include a convenient JSON File Spec definition, which allows you to filter which artifacts you want to download, based on a specific build or even the latest build published. Once the job downloaded the artifacts to the job's workspace, it needs to copy them to your Application Server. There are many ways to do that. You can use a deployment tool like Ansible to push (copy) the artifacts from job workspace to your servers.

实现此目的的最简单方法是创建一个额外的作业Jenkins,它负责从Artifactory下载特定构建的工件并将它们部署到Application Server。我建议使用Pipeline DSL for Artifactory或使用Generic Artifactory Integration的Free-Style作业,因为它们都包含一个方便的JSON File Spec定义,它允许您根据特定构建甚至是过滤要下载哪些工件。最新版本发布。一旦作业将工件下载到作业的工作区,它就需要将它们复制到Application Server。有很多方法可以做到这一点。您可以使用Ansible之类的部署工具将工件从工作空间推送(复制)到服务器。

#2


0  

Create a new jenkins job say job1_deployApp to deploy your App server. Configure this job as downstream job of the other job from where you want to copy the build artifacts say job2_build.

创建一个新的jenkins作业,比如job1_deployApp来部署你的App服务器。将此作业配置为要从中复制构建工件的其他作业的下游作业,如job2_build。

Configure archive artifacts in job2_build to archive the needed build artifacts. So once this job is over it will trigger job1_deployApp.

在job2_build中配置归​​档工件以归档所需的构建工件。所以一旦这个工作结束,它将触发job1_deployApp。

Configure job1_deployApp to copy artifacts from job2_build. It will copy all the artifacts which were archived in `job2_build. Hence you will get the required artifacts to deploy your App server.

配置job1_deployApp以从job2_build复制工件。它将复制在`job2_build中存档的所有工件。因此,您将获得部署App服务器所需的工件。

#1


3  

The easiest way to achieve this is by creating an additional job Jenkins, which is responsible for downloading the artifacts of a specific build from Artifactory and deploying them to your Application Server. I recommend using the Pipeline DSL for Artifactory or a Free-Style job with the Generic Artifactory Integration, because both include a convenient JSON File Spec definition, which allows you to filter which artifacts you want to download, based on a specific build or even the latest build published. Once the job downloaded the artifacts to the job's workspace, it needs to copy them to your Application Server. There are many ways to do that. You can use a deployment tool like Ansible to push (copy) the artifacts from job workspace to your servers.

实现此目的的最简单方法是创建一个额外的作业Jenkins,它负责从Artifactory下载特定构建的工件并将它们部署到Application Server。我建议使用Pipeline DSL for Artifactory或使用Generic Artifactory Integration的Free-Style作业,因为它们都包含一个方便的JSON File Spec定义,它允许您根据特定构建甚至是过滤要下载哪些工件。最新版本发布。一旦作业将工件下载到作业的工作区,它就需要将它们复制到Application Server。有很多方法可以做到这一点。您可以使用Ansible之类的部署工具将工件从工作空间推送(复制)到服务器。

#2


0  

Create a new jenkins job say job1_deployApp to deploy your App server. Configure this job as downstream job of the other job from where you want to copy the build artifacts say job2_build.

创建一个新的jenkins作业,比如job1_deployApp来部署你的App服务器。将此作业配置为要从中复制构建工件的其他作业的下游作业,如job2_build。

Configure archive artifacts in job2_build to archive the needed build artifacts. So once this job is over it will trigger job1_deployApp.

在job2_build中配置归​​档工件以归档所需的构建工件。所以一旦这个工作结束,它将触发job1_deployApp。

Configure job1_deployApp to copy artifacts from job2_build. It will copy all the artifacts which were archived in `job2_build. Hence you will get the required artifacts to deploy your App server.

配置job1_deployApp以从job2_build复制工件。它将复制在`job2_build中存档的所有工件。因此,您将获得部署App服务器所需的工件。