2017-02-04 41 views
0

我需要監視遠程SFTP文件夾才能觸發我的Jenkins腳本管道。Jenkins腳本管道的自定義觸發器

我在Google和Jenkins文檔上搜索過,但是我找不到在哪裏插入將由Jenkins用來決定觸發或不是我的工作的自定義代碼。

你知道是否有可能或者我應該寫一個自定義插件?

回答

0

我猜測推動觸發構建是不可能的,你需要退回到投票。在這種情況下,我將創建一個監視遠程SFTP文件夾的第二個管道作業。如果檢測到更改,則會使用步驟build觸發實際作業。東西的線路:

node { 
    def changes = false; 
    // Do your monitoring of the SFTP server here and set changes to true if changes are detected. If you need a state between different runs of this job, then you can use the archive and copyArtifact step to save and retrieve state from last run. 
    if (changes) { 
    build job: 'A', propagate: false, wait: false 
    } 

然後將此作業設置定期觸發: Triggering periodically