在通用 Jenkins 项目中将工件部署到 Artifactory

Deploying artifacts to Artifactory in a generic Jenkins project

我正在使用 Jenkins Matrix plugin 创建三种不同类型的构建(开发、发布、制造)。每种构建类型都有自己的 artifactory repository

有没有办法配置 Jenkins Artifactory plugin 根据条件将工件部署到不同的存储库? (即矩阵构建的类型)。

目前我只看到部署到单个存储库的选项。 我的项目是一个通用项目,它使用 groovy 脚本构建 tar.gz 文件。

这似乎是插件的一个缺点HAP-568

Currently there is only the ability to deploy to a single Artifactory repository from a Jenkins CI job. It would be nice to have the ability to deploy separate artifacts to multiple repositories from the same Jenkins CI job. It would be even better if these multiple repos don't need to be on the same server, but that would only be a nice-to-have. An example would be a Jenkins CI job that builds souce that outputs both debian, yum, and pypi. It needs to deploy each to separate Artifactory repositories.

作为解决方法,您可以使用 curl 推送到 artifactory

curl -u <user>:<password> -s  -X PUT \
     --data-binary @<file> http://<artifactory-server>/<directory>/<file>