gitlab-plugin
gitlab-plugin copied to clipboard
Jenkins Gitlab squash commit error stderr: fatal: ambiguous argument '^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'
When we merge with squash commit Jenkins fail with the following error `
09:27:56 stdout: d8fd53f8c5c1522678cfae1af81f2c61eb1ec8a3^{commit}
09:27:56
09:27:56 stderr: fatal: ambiguous argument 'd8fd53f8c5c1522678cfae1af81f2c61eb1ec8a3^{commit}': unknown revision or path not in the working tree.
09:27:56 Use '--' to separate paths from revisions, like this:
09:27:56 'git <command> [<revision>...] -- [<file>...]```
However when we merge without squash commit, pipeline runs successful
This issue happen when we checkout using gitlab plugin and below is the Jenkins checkout script
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "origin/${env.gitlabSourceBranch}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: "gitlab-ssh",
url: gitlabTargetRepoSshUrl
]]
]
Please can you advise?
Hello same issue here !
Need to disable squash commit into the PR.
Hey, same issue here, it only happens when I squash commits on merge requests.
hudson.plugins.git.GitException: Command "git rev-parse 98a6d794e986f081fcc1b6357502cf1ca8558d16^{commit}" returned status code 128:
stdout: 98a6d794e986f081fcc1b6357502cf1ca8558d16^{commit}
stderr: fatal: ambiguous argument '98a6d794e986f081fcc1b6357502cf1ca8558d16^{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:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2601)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2597)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1968)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1980)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:1082)
at hudson.plugins.git.GitAPI.revParse(GitAPI.java:337)
at hudson.plugins.git.RevisionParameterAction.toRevision(RevisionParameterAction.java:98)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1140)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1303)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE
Hello, Also experiencing this issue. Is there any w/a till it will be solved?
In my case, this error happened because in my merge requests I've checked the option "Delete source branch when merge request is accepted". Since your branch is deleted when merge request is accepted and gitlab webhook event has a reference to your last commit in that branch, this error is triggered.
A workaround would be probably to delete the branch via REST API in post-steps in your Jenkinsfile.