简体   繁体   English

在我的构建逻辑中检索jenkins插件信息

[英]Retrieving jenkins plugin information in my build logic

My area is wanting to move our build system to Jenkins and I need to understand more about it. 我所在的地区想将我们的构建系统迁移到Jenkins,我需要更多地了解它。 I believe I have a fairly good idea of what I want to do, but not sure of some details. 我相信我对自己想做的事情有一个很好的主意,但不确定某些细节。

For example, I want to use the URLTrigger plugin to watch several different areas that could externally trigger the build of a project. 例如,我想使用URLTrigger插件来观察可能从外部触发项目构建的几个不同区域。 The idea is that when one of these URLTriggers happens, my build will then be instantiated by Jenkins. 这个想法是,当这些URLTriggers中的一个发生时,我的构建将由Jenkins实例化。

The build logic would then download a file from that URL location (an Artifactory publish) and do a bit of processing to determine if THIS build needs to continue (more processing performed, followed by a publish) or not (based on download file contents, it turns out there is nothing to do, so stop). 然后,构建逻辑将从该URL位置下载文件(人工发布),并进行一些处理以确定此构建是否需要继续(执行更多处理,然后发布)(基于下载文件的内容,原来没有事可做,所以停下来。

Is there a way for the build logic to determine WHICH specific URLTrigger-monitored area triggered THIS build? 生成逻辑是否有办法确定特定的URLTrigger监视的区域触发了此生成? If so, my build logic would only need to download and process that one specific download instead of going to the burden of downloading from ALL of the areas I have configured URLTrigger to monitor. 如果是这样,我的构建逻辑将只需要下载并处理一个特定的下载,而无需承担从配置URLTrigger监视的所有区域下载的负担。

After investigating this more I'll attempt to answer my own question... 在对此进行更多调查之后,我将尝试回答我自己的问题...

The short answer is "no". 最简洁的答案是不”。

It seems that when you have several resources being monitored by URLTrigger, whenever ANY ONE OR MORE of these resources causes the trigger to fire, it fires and triggers a build. 看来,当您有多个资源由URLTrigger监视时,只要这些资源中的任何一个或多个引起触发器触发,它就会触发并触发构建。
During the build I can find no way to determine which of the monitored resources actually caused the trigger to fire. 在构建过程中,我无法确定哪一个受监视的资源实际上导致了触发器的触发。
The only way to determine WHY this build was triggered that I can think of is to go to the trouble (and expense) of downloading ALL monitored resources and then determining on my own which ones have changed. 我可以想到的确定为什么触发此构建的唯一方法是去麻烦(和花钱),下载所有受监视的资源,然后自己确定哪些资源已更改。
That's a shame, since it seems the URLTrigger would have this information already, and I'm now doing redundant work in the build. 真可惜,因为URLTrigger似乎已经有了此信息,而我现在正在构建中进行多余的工作。 Missed opportunities! 错失良机!

Also, since I'll be interrogating these resources at BUILD time, they may have changed since the URLTrigger polling interrogated them, so that seems very poor. 另外,由于我将在BUILD时询问这些资源,因此自URLTrigger轮询询问这些资源以来,它们可能已更改,因此这似乎很差。 I'll need to do some hokey stuff to allow for that I suppose. 我需要做一些曲折的事情,以考虑到我的想法。

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

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