3

I created a new pipeline for testing purposes to build a feature branch.

Git branch: feature/show-percentage-of-completion Script path: Jenkinsfile-cirrus-dev-feature Lightweight checkout: Not checked

When I run the build, I get this error below:

    Started by user woodsman1@mycompany.com
    Checking out git git@github.mycompany.com:IC2E-SPRINT/cirrus-bluecost-ssc-file-generator.git into /jenkins_data/jenkins_home/jobs/cirrus-bluecost-ssc-cost-file-generator-dev-feature/workspace@script to read Jenkinsfile-cirrus-dev-feature
    The recommended git tool is: git
    using credential bluecost_git
     > git rev-parse --resolve-git-dir /jenkins_data/jenkins_home/jobs/cirrus-bluecost-ssc-cost-file-generator-dev-feature/workspace@script/.git # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url git@github.mycompany.com:IC2E-SPRINT/cirrus-bluecost-ssc-file-generator.git # timeout=10
    Fetching upstream changes from git@github.mycompany.com:IC2E-SPRINT/cirrus-bluecost-ssc-file-generator.git
     > git --version # timeout=10
     > git --version # 'git version 2.20.1'
    using GIT_SSH to set credentials Bluecost (dpydalsprd101.sl.bluecloud.mycompany.com, /home/bluecost/.ssh )
     > git fetch --tags --force --progress -- git@github.mycompany.com:IC2E-SPRINT/cirrus-bluecost-ssc-file-generator.git +refs/heads/*:refs/remotes/origin/* # timeout=10
     > git rev-parse refs/remotes/origin/feature/show-percentage-of-completion^{commit} # timeout=10
     > git rev-parse origin/feature/show-percentage-of-completion^{commit} # timeout=10
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    ERROR: Maximum checkout retry attempts reached, aborting
    Finished: FAILURE

What I don't understand about Jenkins is that I give it a repo and a branch name. Does it do git clone my-repo and then git checkout my-branch? No, it have to do this weird git --version, git --version ; git fetch; git rev-parse; git rev-parse. I have no idea why they found a set of cryptic steps to do this.

Also, I've verified both the repository and the branch exist. If I switched to the test branch, it would work. Why?

PS: a comment was made about checking the ref/spec. I wasn't sure where the commenter was referring, but I noticed this exists in the .git/config file as follows:

[branch "feature/show-percentage-of-completion"]
    remote = origin
    merge = refs/heads/feature/show-percentage-of-completion

enter image description here

Woodsman
  • 901
  • 21
  • 61
  • I refer to the field you see in https://stackoverflow.com/q/15447661/6309 – VonC Aug 27 '21 at 06:55
  • That screenshot does not show the refspec field (which should be right above it) – VonC Aug 27 '21 at 06:58
  • In your repo, is `feature/show-percentage-of-completion` a branch or a tag ? Is it listed in `git branch` ? – LeGEC Aug 27 '21 at 07:57

1 Answers1

1

Check your refspec, as seen here.
It should be, in order to fetch all the remote tracking braches, including origin/feature/xxx:

+refs/heads/*:refs/remotes/origin/*

Note:

The Git plugin fetches branches and then look for the HEAD commit to checkout, which means it puts the repository in a detached HEAD state: it switch to a commit, not a branch itself.
Maybe that commit was laready part of a previous build.

As commented below by iftimie-tudor, try and tweak the branch field:

feature/show-percentage-of-completion 
# or
*/show-percentage-of-completion
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • is this an error on the configuration page where the branch is */feature/show-percentage-of-completion, or the plugin line in the Jenkinsfile? – Woodsman Aug 27 '21 at 06:50
  • @Woodsman I wouldn't say for the Jenkinsfile, but if, on your job page, you have as "branch" "`*/feature/show-percentage-of-completion`" that should work (unless there is a typo). Check the refspecfield. – VonC Aug 27 '21 at 06:52
  • Thanks for your help. Can you check my attached screenshot? – Woodsman Aug 27 '21 at 06:57
  • for me it works with feature/show-percentage-of-completion or just */show-percentage-of-completion – TudorIftimie Aug 27 '21 at 08:43
  • @VonC I tried both feature/show-percentage-of-completion and */show-percentage-of-completion. Both don't work. – Woodsman Aug 27 '21 at 15:17
  • @Woodsman Could you try with other branches (with simpler names), just for testing if the issue is for all branches, or just this branch? – VonC Aug 27 '21 at 15:22
  • 1
    this worked. thanks! – algorythms Jan 26 '22 at 06:05