You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a large git repository stored in BitBucket, let's call it main_repo. I created a new repository for a Jenkinsfile, named jenkinsfile_repo. In the jenkinsfile_repo I created a directory named main_repo and put our Jenkinsfile in it. I created a Multibranch Pipline project in Jenkins, according to the documentation here:
When I save it, then the scan process starts, collects our branches from the main_repo correctly. But if a change triggers a build on one of those branches, the build process looks like this:
-branch change triggers a build
-it checks out the jenkinsfile_repo
-then tries to run the Jenkinsfile on the jenkinsfile_repo/ not on the main_repo/.
Here is the console log:
Branch indexing
Checking out com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM into C:\jenkins<main_repo branch name>@script to read main_repo/Jenkinsfile
The recommended git tool is: NONE
using credential 27cc7c94-f898-4cf8-ad4a-51e5cdb95c0f
Cloning the remote Git repository
Cloning repository /scm/sw/jenkinsfile_repo.git
git init C:\jenkins<main_repo branch name>@script # timeout=10
Fetching upstream changes from /scm/sw/jenkinsfile_repo.git
git --version # timeout=10
git --version # 'git version 2.27.0.windows.1'
using GIT_ASKPASS to set credentials
git fetch --tags --force --progress -- /scm/sw/jenkinsfile_repo.git +refs/heads/:refs/remotes/jenkinsfile_repo/ # timeout=10
git config remote.jenkinsfile_repo.url /scm/sw/jenkinsfile_repo.git # timeout=10
git config --add remote.jenkinsfile_repo.fetch +refs/heads/:refs/remotes/jenkinsfile_repo/ # timeout=10
Avoid second fetch
Seen branch in repository jenkinsfile_repo/<main_repo branch name>
Seen branch in repository jenkinsfile_repo/master
Seen 2 remote branches
git show-ref --tags -d # timeout=10
Multiple candidate revisions
Checking out Revision 33938ad54089375aa59ea6c9434f4048a3276707 (jenkinsfile_repo/<main_repo branch name>)
git config core.sparsecheckout # timeout=10
git checkout -f 33938ad54089375aa59ea6c9434f4048a3276707 # timeout=10
Commit message: ""
First time build. Skipping changelog.
Posting build status of INPROGRESS to Bitbucket for commit id [33938ad54089375aa59ea6c9434f4048a3276707] and ref 'null'
[Checks API] No suitable checks publisher found.
Posting build status of FAILED to Bitbucket for commit id [33938ad54089375aa59ea6c9434f4048a3276707] and ref 'null'
[Checks API] No suitable checks publisher found.
ERROR: C:\jenkins<main_repo branch name>@script\main_repo\Jenkinsfile not found
To Reproduce
Steps to reproduce the behavior:
Create a new repository named "jenkinsfile_repo" for storing Jenkins files. It is stored in "/jenkinsfile_repo.git"
Create a directory in the "jenkinsfile_repo" for your project. Name it "main_repo"
Create your Jenkins File, named "Jenkinsfile" under "main_repo" directory, and commit/push it to the "jenkinsfile_repo" repository
Open you Jenkins and create a new MultiBranch Pipeline Project, named "main_repo_job"
Add Branch Sources for your project to build. Fill information for "main_repo".
In the "Build Configuration", change "Mode" to "by Remote Jenkins File Plugin".
Define your script path: "main_repo/Jenkinsfile".
Define your SCM for Jenkins file. For example, it will be the repository /jenkinsfile_repo.git .
Click Save.
Now when a branch changes in the main_repo repository, a build will start. After the Jenkinsfile checkout, the build tries to run Jenkinsfile on their own repository (jenkinsfile_repo), not on the main_repo repository. It will fail, of course, because there isn't any source code in the jenkinsfile_repository.
Expected behavior
If a branch changes in the main_repo repository, then check out that branch, then checkout the Jenkinsfile from jenkinsfile_repo repository and start the compile steps for main_repo described in the Jenkinsfile came from jenkinsfile_repo.
Desktop (please complete the following information):
We have a large git repository stored in BitBucket, let's call it main_repo. I created a new repository for a Jenkinsfile, named jenkinsfile_repo. In the jenkinsfile_repo I created a directory named main_repo and put our Jenkinsfile in it. I created a Multibranch Pipline project in Jenkins, according to the documentation here:
https://plugins.jenkins.io/remote-file/
When I save it, then the scan process starts, collects our branches from the main_repo correctly. But if a change triggers a build on one of those branches, the build process looks like this:
-branch change triggers a build
-it checks out the jenkinsfile_repo
-then tries to run the Jenkinsfile on the jenkinsfile_repo/ not on the main_repo/.
Here is the console log:
Branch indexing
Checking out com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM into C:\jenkins<main_repo branch name>@script to read main_repo/Jenkinsfile
The recommended git tool is: NONE
using credential 27cc7c94-f898-4cf8-ad4a-51e5cdb95c0f
Cloning the remote Git repository
Cloning repository /scm/sw/jenkinsfile_repo.git
To Reproduce
Steps to reproduce the behavior:
Create a new repository named "jenkinsfile_repo" for storing Jenkins files. It is stored in "/jenkinsfile_repo.git"
Create a directory in the "jenkinsfile_repo" for your project. Name it "main_repo"
Create your Jenkins File, named "Jenkinsfile" under "main_repo" directory, and commit/push it to the "jenkinsfile_repo" repository
Open you Jenkins and create a new MultiBranch Pipeline Project, named "main_repo_job"
Add Branch Sources for your project to build. Fill information for "main_repo".
In the "Build Configuration", change "Mode" to "by Remote Jenkins File Plugin".
Define your script path: "main_repo/Jenkinsfile".
Define your SCM for Jenkins file. For example, it will be the repository /jenkinsfile_repo.git .
Click Save.
Now when a branch changes in the main_repo repository, a build will start. After the Jenkinsfile checkout, the build tries to run Jenkinsfile on their own repository (jenkinsfile_repo), not on the main_repo repository. It will fail, of course, because there isn't any source code in the jenkinsfile_repository.
Expected behavior
If a branch changes in the main_repo repository, then check out that branch, then checkout the Jenkinsfile from jenkinsfile_repo repository and start the compile steps for main_repo described in the Jenkinsfile came from jenkinsfile_repo.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: