Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66653

ERROR: Couldn't find any revision to build

XMLWordPrintable

      In my Jenkinsfile I have the following checkout step which gets the repo info from parameters:
       

      checkout BbS (
          projectName: params.BITBUCKET_PROJECT_KEY,
          repositoryName: params.REPOSITORY,
          branches: [[name: params.BRANCH]],
          credentialsId: 'jess-crowd',
          sshCredentialsId: 'jess-ssh',
          extensions: [
              [$class: 'WipeWorkspace'],
              [$class: 'CloneOption', shallow: true, depth: 1, noTags: false]
          ], 
          id: '72e64622-046f-4d55-a545-1d9ce6d20c4f',
          serverId: 'af4c3bd5-289f-4d38-9e96-c89adc788dad'
      )
      

       
      and I can confirm that the plugin uses the parameter values as the console outputs:

      git rev-parse "refs/remotes/origin/feature/my-new-feature^{commit}"

      But I have also tried with hardcoding the project name (not project key) and repository name, to no effect.

      While all these commands return commit hashes when run in my local checkout, when run on Jenkins pipeline they fail with the error message:

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

      Note that my branch name does have a slash in it (e.g. feature/my-new-feature). So as suggested by others who faced similar issues, I have also tried to be more specific with the branch reference, but with no success.

      • branches: [[name: "refs/heads/${params.BRANCH}"]]
      • branches: [[name: "origin/${params.BRANCH}"]]
      • branches: [[name: "refs/remotes/origin/${params.BRANCH}"]]

      Even specifying any branch "**" returns nothing! No remote branches found...!?

      So I have also checked the `Configure System` settings, which confirms "Jenkins can connect with Bitbucket Server." and also the Application Link configuration, which seems to be okay.

      Can you please advise how to correctly configure the step in the Jenkinsfile.

      I also want to note that the credentials are valid as the pipeline 'snippet generator' can resolve the project key and repo names.
       

            Unassigned Unassigned
            jess Gordon Jess
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: