I have a Job which uses a Pipeline from SCM (from GitHub) with Lightweight checkout enabled. My pipeline uses a Shared Library that also comes from GitHub.
Within my pipeline, I do few checkouts of the actual project from another SCM (RTC, if that matters).
My intention is that the builds are only to be triggered for changes in the project, that is, RTC. Changes in the GitHub repositories shouldn't trigger anything.
This worked fine for months... Even the Lightweight checkout info says that "The advantage of this mode is its efficiency; however, you will not get any changelogs or polling based on the SCM", which is exactly what I want.
One day, out of blue, Jenkins started detecting changes in the pipeline repo as well, started triggering builds from there and hasn't stopped ever since.
I already tried to add Additional Behaviours -> Polling ignores commits in certain paths -> Excluded Regions -> .*
Also, Included Regions -> unexisting-file-out-of-desperation
, but Jenkins just don't stop polling it!
This is the polling log
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
Interestingly, I created a copy of that Job, and polling ran for the first time because...
Started on Nov 10, 2023, 9:56:00 PM
no previous build to compare to
Done. Took 0 ms
Changes found
... then it realized that there is no reason for polling:
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
But the original Job is uncontrollable. Any suggestion on how to fix that?
I already had similar polling issues happen in the past, even with RTC as SCM, and the only way out had always been to recreate the jobs. But I can't live like that...
EDIT: My issue is happening in a regular Pipeline Job. No multibranch.
Also, just in case, last time I had this issue I opened a question in the Jenkins Forum. I got were very much appreciated workarounds, but no solution either.
What I'm posting is by no means a solution, but rather a workaround that I assume to be safe. I'm hesitant to mark it as solution because I have hope someone will post something better :-)
Re-creating a job from scratch works, as mentioned in the question. But the issue might eventually just come back on its own.
So, to re-create it on the safe side, I explicitly added the option mentioned in question to the new Job: Additional Behaviours -> Polling ignores commits in certain paths -> Excluded Regions -> .*
Unlike the job in which I added this option after it was already broken, the new one recognizes the new configuration and correctly skip the paths. This is seen in the polling log:
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
Now even if it decides to poll my Pipeline repository (which it seems to do already anyway), at least the extra settings prevents it from triggering the build based on those changes and against my intentions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With