-
Bug
-
Resolution: Won't Fix
-
Trivial
-
None
-
Jenkins Version 2.516.2
Git Plugin Version: [5.7.0](https://plugins.jenkins.io/git)
Pipeline: Groovy Version: 4183.v94b_6fd39da_c1
Service(s)
plugins.jenkins.io
Summary
Problem Summary
When configuring a Pipeline job to use "Pipeline script from SCM" with a Git repository that contains the Jenkinsfile in a Git submodule, the build fails immediately with an error stating it cannot find the Jenkinsfile. This happens even though the "Recursively update submodules" behavior is added in the job configuration.
The error observed is:
text
ERROR: Unable to find .ci/Jenkinsfile from git https://code.example.com/group/project.git
Finished: FAILURE
However, manually cloning the same repository and running git submodule update --init --recursive on the Jenkins server works perfectly and the file is present in the expected path (.ci/Jenkinsfile).
This suggests that Jenkins attempts to locate and parse the Jenkinsfile before the submodule update process has fully completed or initialized successfully.
Reproduction steps
1.Create a Git repository (main-repo) for a project.
2.Create another Git repository (ci-files) to host the Jenkinsfile.
3.In main-repo, add ci-files as a Git submodule in the .ci directory.
git submodule add <url-of-ci-files-repo> .ci
4.In the Jenkins web interface, create a new Pipeline job.
5.Configure the Pipeline section:
Definition: Pipeline script from SCM
SCM: Git
Repository URL:
Script Path: .ci/Jenkinsfile
6.In the Git SCM configuration, under "Additional Behaviours", add "Recursively update submodules". and add "Use credentials from default remote of parent repository"
7.Save the job and run it.
Expected Result
The build should:
1.Clone the main-repo.
2.Initialize and update the submodule located at .ci, fetching the contents of the ci-files repository.
3.Locate the Jenkinsfile within the .ci subdirectory.
4.Proceed to execute the pipeline defined in that Jenkinsfile.
Actual Result
The build fails immediately after the initial clone of the main-repo, before the submodule is fully initialized and populated. The error indicates the Jenkinsfile is not found, implying the submodule update step happens after the initial lookup for the Jenkinsfile or fails silently.