简体   繁体   English

在没有 Artifactory 插件的情况下将 Jenkins 凭据传递给 Artifactory

[英]Passing Jenkins credentials to Artifactory without the Artifactory plugin

I have been asked to work on an older shared version of Jenkins.我被要求处理 Jenkins 的旧共享版本。 It is so old that installing the Artifactory plug-in is just not possible.它太旧了,无法安装 Artifactory 插件。 The latest version of the plug-in wont load and installing the older version and all its dependencies without an internet connection is just a pain.插件的最新版本在没有互联网连接的情况下无法加载和安装旧版本及其所有依赖项只是一种痛苦。

In short is there a quick and simple way in which we can pass the credentials to artifactory from Jenkins before Jenkins tries to read or write to the Artifactory repo?简而言之,在 Jenkins 尝试读取或写入 Artifactory 存储库之前,是否有一种快速简单的方法可以将凭据从 Jenkins 传递给工件?

Edit:编辑:

My setup is Jenkins running on RH Linux, building a very simple Maven project with the requirement to output the build artefacts to Artifactory. My setup is Jenkins running on RH Linux, building a very simple Maven project with the requirement to output the build artefacts to Artifactory. JFrog CLI is available with my version of Artifactory, however is not running currently on the Linux box. JFrog CLI 可用于我的 Artifactory 版本,但目前未在 Linux 盒子上运行。

Option 1 - JFrog CLI选项 1 - JFrog CLI

See the documentation of the Maven commands.请参阅 Maven 命令的文档 JFrog CLI is available on multiple linux architectures (386, amd64, arm64, arm, s390x to date). JFrog CLI 可用于多种 linux 架构(386、amd64、arm64、arm、s390x 至今)。 You can install it as part of your pipeline.您可以将其安装为管道的一部分。 Get it here .在这里得到它。

Option 2 - Maven Artifactory Plugin选项 2 - Maven Artifactory 插件

See the documentation of the plugin.请参阅插件的文档 You can also learn how to use the plugin from this project example .您还可以从这个项目示例中学习如何使用插件。

You could simply use the Artifactory REST API with curl.您可以简单地将 Artifactory REST API 与 curl 一起使用。 Depending on your repository:根据您的存储库:

curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt

The documentation from JFrog about this is actually pretty good. JFrog 关于这方面的文档实际上非常好。 You can also add hashes and other parameters this way.您也可以通过这种方式添加哈希和其他参数。

https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM