+1 voto
404 visitas

Do nada, depois de fazer fetch no repositório começa a ocorrer erro de "cannot lock ref" no clone.

Exemplo:

git fetch --tags --progress -- http://gitlab.benner.com.br/corporativo/produto.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 ERROR: Error fetching remote repo 'origin'
 hudson.plugins.git.GitException: Failed to fetch from http://gitlab.benner.com.br/corporativo/produto.git
 	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:899)
 	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1114)
 	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1145)
 	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
 	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
 	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
 	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
 	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)
 Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress -- http://gitlab.benner.com.br/corporativo/produto.git +refs/heads/*:refs/remotes/origin/*" returned status code 1:
 stdout: 
[2019-12-03T16:18:21.446Z] stderr: error: cannot lock ref 'refs/remotes/origin/05.20.OSESP.Merge': is at 6290df7f723ecac2f902ea6fc78e61773f71385c but expected 459a0ee9bedc13e11d95787872ae73464539095b
 From http://gitlab.benner.com.br/corporativo/produto
  ! 459a0ee9be...00a67849ae 05.20.OSESP.Merge -> origin/05.20.OSESP.Merge  (unable to update local ref)
 
 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2372)
 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1985)
 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:80)
 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:563)
 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154)
 	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
 	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
 	at hudson.remoting.Request$2.run(Request.java:369)
 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
 	at java.util.concurrent.FutureTask.run(Unknown Source)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
 	at java.lang.Thread.run(Unknown Source)
 	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from bnu-slave002.benner.com.br/192.168.5.183:63021
 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
 		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
 		at hudson.remoting.Channel.call(Channel.java:957)
 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
 		at sun.reflect.GeneratedMethodAccessor641.invoke(Unknown Source)
 		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 		at java.lang.reflect.Method.invoke(Method.java:498)
 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
 		at com.sun.proxy.$Proxy146.execute(Unknown Source)
 		at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:897)
 		at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1114)
 		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1145)
 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
 		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
 		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)
por (539 pontos) | 404 visitas

1 Resposta

0 votos

Este problema acontece pq o Git vem do conceito do Linux e portanto diferencia nomes de branches com maiúsculas e minúsculas.

Mais para cima no log vão aparecer as duas branches, no caso deste exemplo veja abaixo:

 Seen branch in repository origin/05.20.OSESP.00
 Seen branch in repository origin/05.20.OSESP.MERGE
 Seen branch in repository origin/05.20.OSESP.Merge
 Seen branch in repository origin/05.20.medicarct2
 Seen branch in repository origin/05.PRIME.02-SMS-1723635

A solução é remover (no servidor) uma das duas branches e fazer o fetch novamente.

 

por (539 pontos)
Melhores Sep 2020
  1. Marco.Barros

    6 Pontos

  2. marcio.michelluzzi

    5 Pontos

  3. BlakeBeverly

    5 Pontos

  4. Amelia98M988

    5 Pontos

  5. ErickTaormin

    5 Pontos

  6. EwanCadwalla

    5 Pontos

  7. FrankKotter4

    5 Pontos

  8. NatishaPlayf

    5 Pontos

  9. SidneyGreig

    5 Pontos

  10. fabiosaid

    5 Pontos

200 pontos
Melhores 2020 Sep 21 - 27
  1. Marco.Barros

    6 Pontos

  2. marcio.michelluzzi

    5 Pontos

  3. BlakeBeverly

    5 Pontos

442 perguntas
488 respostas
350 comentários
482 usuários