从jenkins Freestyle项目部署工件

时间:2022-09-06 07:29:33

I have a Jenkins job configured as a Freestyle project. This job is actually building a maven project but I have configured it as freestyle in order to be able to invoke a virtualenv builder (build steps) to run a set of regression tests written in python and shell.

我将Jenkins作业配置为Freestyle项目。这项工作实际上正在构建一个maven项目,但我已将其配置为*式,以便能够调用virtualenv构建器(构建步骤)来运行一组用python和shell编写的回归测试。

Unfortunately it seems like the freestyle projects do not support the post build actions for deploying artifacts like normal maven projects do (referring specifically to the deploy artifacts actions). Any idea how I can workaround that?

不幸的是,似乎*式项目不支持像普通maven项目那样部署工件的后期构建操作(具体指代部署工件操作)。知道如何解决这个问题吗?

On the other hand if I choose to build the project as a normal maven project then I cannot invoke the virtualenv builder therefore cannot run the regression tests.

另一方面,如果我选择将项目构建为普通的maven项目,那么我就无法调用virtualenv构建器,因此无法运行回归测试。

I guess I could divide the build to two jobs, one building the artifact and deploying it to artifactory and the second retrieving it and running the regression tests. But this means that if the second job fails the deployed artifact must be removed. Which is not exactly ideal.

我想我可以将构建分成两个作业,一个构建工件并将其部署到artifactory,第二个检索它并运行回归测试。但这意味着如果第二个作业失败,则必须删除已部署的工件。哪个不完全理想。

1 个解决方案

#1


0  

A freestyle job does support shell or bat post-build step in which you can type the command you want.

*式作业确实支持shell或bat后构建步骤,您可以在其中键入所需的命令。

Here, a maven deploy-file command in order to deploy to your Maven repo (an Artifactory one)

这里是一个maven deploy-file命令,用于部署到你的Maven仓库(一个Artifactory仓库)

mvn deploy:deploy-file -Durl=http://myartifactory/artifactory/repositoryId \
  -DrepositoryId=repositoryId -Dfile=target\my.jar \ 
  -DgroupId=org.group -DartifactId=art -Dversion=3.0-SNAPSHOT -Dpackaging=jar

If you know your GAV during the job, you can deploy it through command line.

如果您在工作期间了解GAV,则可以通过命令行进行部署。

#1


0  

A freestyle job does support shell or bat post-build step in which you can type the command you want.

*式作业确实支持shell或bat后构建步骤,您可以在其中键入所需的命令。

Here, a maven deploy-file command in order to deploy to your Maven repo (an Artifactory one)

这里是一个maven deploy-file命令,用于部署到你的Maven仓库(一个Artifactory仓库)

mvn deploy:deploy-file -Durl=http://myartifactory/artifactory/repositoryId \
  -DrepositoryId=repositoryId -Dfile=target\my.jar \ 
  -DgroupId=org.group -DartifactId=art -Dversion=3.0-SNAPSHOT -Dpackaging=jar

If you know your GAV during the job, you can deploy it through command line.

如果您在工作期间了解GAV,则可以通过命令行进行部署。