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

Jenkinsfile checkout fails on Merge from Fork using GitLab

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • gitlab-plugin
    • None
    • Jenkins 2.107.2
      Gitlab Plugin 1.5.9

      Take a sample gitlab project 'sampleGroup/sampleProject'.

       

      Fork this project as 'sampleUser/sampleProject'.

       

      Make a change in 'sampleUser/sampleProject' master to file Fx.

       

      Commit change to Fx and create a merge request for that from 'sampleUser/sampleProject' - master to 'sampleGroup/sampleProject' - master.

       

      When the Jenkins job (JenkinsFile pipeline based project) runs for this project, it will fail to checkout JenkinsFile due to the following error...

       
      Triggered by GitLab Merge Request #7: zdarden/master => master
      Obtained Jenkinsfile from git ssh://git@server.domain.com:20022/sampleGroup/sampleProject.git
      Running in Durability level: MAX_SURVIVABILITY[Pipeline] nodeRunning on
      Jenkins
      in /var/jenkins_home/workspace/sampleProject[Pipeline] {[Pipeline] stage[Pipeline]

      { (Declarative: Checkout SCM) [Pipeline] checkout > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url ssh://git@server.domain.com:20022/sampleGroup/sampleProject.git # timeout=10 Fetching upstream changes from ssh://git@server.domain.com:20022/sampleGroup/sampleProject.git > git --version # timeout=10 using GIT_SSH to set credentials jenkins2 private key > git fetch --tags --progress ssh://git@server.domain.com:20022/sampleGroup/sampleProject.git +refs/heads/:refs/remotes/origin/ > git rev-parse edcdd9eece6cf35a64848091b3e1fde8e81320f0^

      {commit}
      1. timeout=10[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // node[Pipeline] stage[Pipeline] { (Declarative: Post Actions)[Pipeline] updateGitlabCommitStatus[Pipeline] }

        [Pipeline] // stage[Pipeline] End of Pipelinehudson.plugins.git.GitException: Command "git rev-parse edcdd9eece6cf35a64848091b3e1fde8e81320f0^{commit}" returned status code 128: stdout: edcdd9eece6cf35a64848091b3e1fde8e81320f0^{commit} stderr: fatal: ambiguous argument 'edcdd9eece6cf35a64848091b3e1fde8e81320f0^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...][<file>...]' at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1984) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1980) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1612) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1624) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:809) at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316) at hudson.plugins.git.RevisionParameterAction.toRevision(RevisionParameterAction.java:98) at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1070) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1187) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

      It appears that this is processing the retrieval of JenkinsFile incorrectly as the commit id does not yet exist in the destination project/branch until after this merge.

       

       

      [Note: I was required to alter real project names and server URLs due to corporate security reasons.  Hopefully I didn't mix any of these up]

       

       

            owenmehegan Owen Mehegan
            namkcaz Zachary Darden
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: