简体   繁体   English

Jenkins用于工件分析的插件

[英]Jenkins Plugin for Artifact Analysis

I need to create a Jenkins post build plugin that will open the artifact (an tar.gz file) and retrieve some information from it. 我需要创建一个Jenkins post build插件,该插件将打开工件(tar.gz文件)并从中检索一些信息。 The problem is I'm not sure what is the best entry point to use for this case and how to get the artifact path to open it. 问题是我不确定在这种情况下使用的最佳入口点是什么以及如何获取工件路径来打开它。

Have you already had a similar problem like that? 您是否已经遇到过类似的问题?

  1. Follow the tutorial to create a basic Hello World plug-in and understand the code and how it works. 按照教程创建基本的Hello World插件,并了解代码及其工作方式。
  2. Modify the class to extend Recorder instead of Builder, modify the public static final class DescriptorImpl to extend Publisher : 修改类以扩展Recorder而不是Builder,修改公共静态最终类DescriptorImpl扩展Publisher:

    public static final class DescriptorImpl extends BuildStepDescriptor{ } 公共静态最终类DescriptorImpl扩展了BuildStepDescriptor {}

Also create a class that will implement Action, this class will have some get-ers for plugin name, url, icon and so on. 还要创建一个将实现Action的类,该类将具有一些用于插件名称,URL,图标等的获取器。 You can return empty string for them for now. 您现在可以为他们返回空字符串。

  1. modify the jelly files. 修改果冻文件。

You can get the path using a textbox in jelly script. 您可以使用果冻脚本中的文本框来获取路径。 For example you can use the textbox to set a location where the artifact will be stored and in plug-in implement a method that will search for it. 例如,您可以使用文本框来设置工件的存储位置,并在插件中实现搜索对象的方法。

Also, if you need help creating a Jenkins post-build plugin, I suggest you to take a look at the jacoco and eclemma plugins, especially at the classes that contains Action, Recorder, Builder in their names. 另外,如果您在创建Jenkins后生成插件方面需要帮助,建议您看一下jacoco和eclemma插件,尤其是名称中包含Action,Recorder,Builder的类。

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

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