Couldn't find any revision to build. Verify the repository and branch configuration for this job

26 views
Skip to first unread message

Joel Ng

unread,
Oct 16, 2020, 8:07:36 AM10/16/20
to Jenkins Users
Hello,

I'm getting this strange issue where the checkout command doesn't seem to checkout the latest commit.

This is my error:
[Pipeline] checkout
14:52:51  The recommended git tool is: NONE
14:52:51  using credential repo-access
14:52:51   > git rev-parse --is-inside-work-tree # timeout=10
14:52:51  Fetching changes from the remote Git repository
14:52:51   > git config remote.origin.url g...@bitbucket.org:redacted.git # timeout=10
14:52:52  Fetching upstream changes from g...@bitbucket.org:redacted.git
14:52:52   > git --version # timeout=10
14:52:52   > git --version # 'git version 2.23.3'
14:52:52  using GIT_SSH to set credentials Git access
14:52:52   > git fetch --tags --force --progress -- g...@bitbucket.org:redacted.git +refs/heads/*:refs/remotes/origin/* # timeout=10
14:52:54   > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
14:52:54   > git rev-parse origin/master^{commit} # timeout=10

This is my checkout command:
scmVars = checkout scm: [
    $class: 'GitSCM',
    userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS}", url: "${GIT_URL}"]]
]

This repository has no "master" branch, it only has a "development" branch.

From the docs (https://www.jenkins.io/doc/pipeline/steps/workflow-scm-step/) it says that leaving the branch empty means it will scan all branches, so I was expecting it to checkout the "development" branch. But it seems to be attempting to grab the "master" branch. Why is that?

Thanks in advance!
Regards,
Joel

Mark Waite

unread,
Oct 16, 2020, 8:21:41 AM10/16/20
to Jenkins Users
In this case, since you're inside a pipeline that is running, I don't think that you want to scan all branches.  I think that you want to use the branch that was already determined by the multibranch pipeline that started the job.  So long as you are inside a multibranch pipeline, the settings for the 

On Fri, Oct 16, 2020 at 6:07 AM 'Joel Ng' via Jenkins Users <jenkins...@googlegroups.com> wrote:

This is my checkout command:
scmVars = checkout scm: [
    $class: 'GitSCM',
    userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS}", url: "${GIT_URL}"]]
]


scmVars = checkout scm: [
    $class: 'GitSCM',
    branches: scm.branches,
    userRemoteConfigs: scm.userRemoteConfigs
]

There is an example here if you'd like to see something more in context.
 
This repository has no "master" branch, it only has a "development" branch.

From the docs (https://www.jenkins.io/doc/pipeline/steps/workflow-scm-step/) it says that leaving the branch empty means it will scan all branches, so I was expecting it to checkout the "development" branch. But it seems to be attempting to grab the "master" branch. Why is that?

Thanks in advance!
Regards,
Joel

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3a1c8643-b888-4576-a7fa-45b6bda50d36n%40googlegroups.com.

Joel Ng

unread,
Oct 19, 2020, 12:23:20 AM10/19/20
to Jenkins Users
Ah! Thank you so much, it's finally working as expected.

This problem was driving me mad

Reply all
Reply to author
Forward
0 new messages