简体   繁体   English

Artifactory REST API:如何生成构建信息json

[英]Artifactory REST API: How to generate Build Info json

I'm trying to generate within a build job a JSON build info file to upload to Artifactory and create a trace-ability between the two tools. 我正在尝试在构建作业中生成JSON构建信息文件,以上传到Artifactory,并在两个工具之间创建可跟踪性。 However the regular Jenkins JSON API file is not in the correct design, therefore I need to generate a new one while running a job. 但是常规的Jenkins JSON API文件设计不正确,因此我需要在运行作业时生成一个新文件。 The question is simple, how do I do that? 问题很简单,我该怎么办? Is there some specific plugin(tool) I need to add to Jenkins, or perhaps just a simple set of commands will do the work? 我是否需要在Jenkins中添加一些特定的插件(工具),或者只是一组简单的命令就能完成工作?

Thanks in advance! 提前致谢!

您可以使用此示例演示如何轻松地将构建信息创建和部署到Artifactory中。

I'd suggest generating the BuildInfo JSON in a separate script, not from Jenkins itself. 我建议不要使用Jenkins本身的脚本来生成BuildInfo JSON。 Jenkins will just call that script and pass all the info about the build environment (like build name, build number and other environment variables). Jenkins只会调用该脚本并传递有关构建环境的所有信息(例如,构建名称,内部编号和其他环境变量)。

And here's an example of how you can generate the BuildInfo . 是如何生成BuildInfo的示例

You can use Artifactory Jenkins plugin . 您可以使用Artifactory Jenkins插件

This will do exactly what you want (If you are not using Java build tools like Maven, Gradle or Ivy use freestyle job and choose "Generic integration"). 这将完全满足您的要求(如果您未使用Maven,Gradle或Ivy之类的Java构建工具,请使用自由样式作业,然后选择“通用集成”)。

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

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