如何禁用Jenkins轮询只为'管道从SCM'?

1tu0hz3e  于 9个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(169)

我有一个作业,它使用了来自SCM的管道(来自GitHub),并启用了 * 轻量级 checkout *。我的管道使用了同样来自GitHub的共享库。
在我的管道中,我从另一个SCM(RTC,如果这很重要的话) checkout 了一些实际项目。
我的意图是,构建只会在项目中发生更改时触发,也就是RTC。GitHub存储库中的更改不应该触发任何东西。
这几个月来都很好.甚至 * 轻量级结帐 * 信息说 “这种模式的优点是它的效率;然而,你不会得到任何基于SCM的更新日志或轮询",这正是我想要的。
突然有一天,Jenkins也开始检测管道仓库中的变化,并开始从那里触发构建,从那以后就没有停止过。
我已经尝试添加Additional Behaviours -> Polling ignores commits in certain paths -> Excluded Regions ->.* Also,Included Regions ->unexisting-file-out-of-desperation,但是Jenkins就是不停止轮询它!
这是投票记录

Started on Nov 10, 2023, 9:58:00 PM
Using strategy: Default
[poll] Last Built Revision: Revision 5c4406e529101df3cc8cb3aef212f3decf0c96ea (origin/85-updates-in-this-repository-are-triggering-myproj-sw-builds-in-jenkins)
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential localuser-github-personal-access-token
 > git --version # timeout=10
 > git --version # 'git version 2.39.2'
using GIT_ASKPASS to set credentials localuser's Personal Access Token at GitHub (DO NOT DELETE; DO NOT UPDATE)
Setting http proxy: proxy-sl.temp.com:8080
 > git ls-remote -h -- https://github.tempdevcloud.com/bios-tools/myproj-gradle-project.git # timeout=10
Found 9 remote heads on https://github.tempdevcloud.com/bios-tools/myproj-gradle-project.git
[poll] Latest remote head revision on refs/heads/main is: 643e37aa70614544bff50a0e7641f4ab3dc96e2f
RTC : checking for changes...
Determining if there are incoming changes using the build toolkit
Checking incoming changes for "myproj_Platform_Dev_CITeam"
Reusing facade for /var/jenkins_home/tools/com.ibm.team.build.internal.hjplugin.RTCBuildToolInstallation/RTC_Build_Toolkit_7.0.2-20220301_temp_fix/RCM-EWM-BuildSystem-Toolkit-Win64-7.0.2-202203010930-FINALGA/buildsystem/buildtoolkit
RTC : No changes detected
Done. Took 2.7 sec
Changes found

字符串
有趣的是,我创建了一个作业的副本,并第一次运行投票,因为.

Started on Nov 10, 2023, 9:56:00 PM
no previous build to compare to
Done. Took 0 ms
Changes found


.然后它意识到没有理由进行投票:

Started on Nov 10, 2023, 10:14:00 PM
no polling baseline in /var/jenkins_home/workspace/rar6si/test-stpid-polling-in-loop@libs/ba472398708df440adf10397fd167023c27c2ddec78fa7f630bc7a43d116b64a on 
Done. Took 0 ms
No changes


但原来的工作是不可控的。有什么建议如何解决这个问题?

  • 我过去已经发生过类似的轮询问题,即使RTC作为SCM,唯一的出路一直是重新创建作业。但我不能这样生活...... *
    **编辑:**我的问题发生在一个常规的Pipeline Job中。没有多分支。

另外,以防万一,上次我遇到这个问题时,我在Jenkins Forum中打开了一个问题。我得到了非常感谢的解决方法,但也没有解决方案。

0yycz8jy

0yycz8jy1#

我发布的是绝不是一个解决方案,而是一个变通办法,我认为是安全的。* 我犹豫是否将其标记为解决方案,因为我希望有人会发布更好的东西 :-)
正如问题中提到的,从头开始重新创建一个工作是可行的,但这个问题最终可能会自己回来。
所以,为了安全起见,我显式地将上述选项添加到新的Job中:**Additional Behaviours -> Polling ignores commits in certain paths -> Excluded Regions ->

有什么区别吗?
与我在作业中添加此选项时它已经 * 损坏 * 不同,新的作业识别新的配置并正确跳过路径。这在轮询日志中可以看到:

Started on Nov 21, 2023, 4:24:00 PM
Using strategy: Default
[poll] Last Built Revision: Revision df8c83434ef56f7af0f52472867719914088f86d (origin/main)
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential localuser-github-personal-access-token
 > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/****/****_dev@libs/ba472398708df440adf10397fd167023c27c2ddec78fa7f630bc7a43******/.git # timeout=10
Fetching changes from the remote Git repositories
 > git config remote.origin.url https://github.tempdevcloud.com/bios-tools/myproj-gradle-project.git # timeout=10
Fetching upstream changes from https://github.tempdevcloud.com/bios-tools/myproj-gradle-project.git
 > git --version # timeout=10
 > git --version # 'git version 2.39.2'
using GIT_ASKPASS to set credentials localuser's Personal Access Token at GitHub (DO NOT DELETE; DO NOT UPDATE)
Setting http proxy: proxy-sl.temp.com:8080
 > git fetch --tags --force --progress -- https://github.tempdevcloud.com/bios-tools/myproj-gradle-project.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Polling for changes in
 > git rev-parse origin/main^{commit} # timeout=10
 > git log --full-history --no-abbrev --format=raw -M -m --raw df8c83434ef56f7af0f52472867719914088f86d..10724295f7cc7a45352b45cf645308706abccdc9 # timeout=10
Ignored commit 10724295f7cc7a45352b45cf645308706abccdc9: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit 753a31ff4fa880716887d7e3bb3b10a52aaec20a: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit e2ddfce9389b4fec4f2beefb0c60478003ca0909: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit e2ddfce9389b4fec4f2beefb0c60478003ca0909: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit 108d38acd039b10d62cc3c20f28b29e289aa7028: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit ac606826aad0c6833fd6306e9c74dbebb7a82562: Found only excluded paths: .pipelines/Jenkinsfile
Ignored commit 5804ff30ee9926fb0ac738d8c1d14a32c2c3b3ff: Found only excluded paths: .pipelines/Jenkinsfile
RTC : checking for changes...
Determining if there are incoming changes using the build toolkit
Checking incoming changes for "****_dev"
Reusing facade for /var/jenkins_home/tools/com.ibm.team.build.internal.hjplugin.RTCBuildToolInstallation/RTC_Build_Toolkit_7.0.2-20220301_temp_fix/RCM-EWM-BuildSystem-Toolkit-Win64-7.0.2-202203010930-FINALGA/buildsystem/buildtoolkit
RTC : No changes detected
Done. Took 0.66 sec
No changes

字符串
现在,即使它决定轮询我的Pipeline存储库(它似乎已经这样做了),至少额外的设置可以防止它根据这些更改触发构建,而不是我的意图。

相关问题