web-dev-qa-db-fra.com

Pourquoi Jenkins échoue-t-il lors de l'extraction depuis git, alors que la ligne de commande ne l'est pas?

Toutes mes versions de Jenkins échouent à la ligne git fetch

Il échoue à git fetch --tags --progress [email protected]:ethenwilson/whentoact.git

Started by user anonymous
Building in workspace /Users/ethen/.jenkins/workspace/Build NikNik
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.Origin.url [email protected]:ethenwilson/whentoact.git
Fetching upstream changes from [email protected]:ethenwilson/whentoact.git
 > git --version
using GIT_SSH to set credentials NikNik BitBucket SSH Key
 > git fetch --tags --progress [email protected]:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/Origin/*
FATAL: Failed to fetch from [email protected]:ethenwilson/whentoact.git
hudson.plugins.git.GitException: Failed to fetch from [email protected]:ethenwilson/whentoact.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.Java:622)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.Java:854)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.Java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.Java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.Java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.Java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.Java:530)
    at hudson.model.Run.execute(Run.Java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.Java:43)
    at hudson.model.ResourceController.execute(ResourceController.Java:88)
    at hudson.model.Executor.run(Executor.Java:234)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress [email protected]:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/Origin/*" returned status code 128:
stdout: 
stderr: remote: Counting objects: 2682, done.[K
remote: Compressing objects:   0% (1/1399)   [K
remote: Compressing objects:   1% (14/1399)   [K
remote: Compressing objects:   2% (28/1399)   [K
remote: Compressing objects:   3% (42/1399)   [K
remote: Compressing objects:   4% (56/1399)   [K
remote: Compressing objects:   5% (70/1399)   [K
remote: Compressing objects:   6% (84/1399)   [K
remote: Compressing objects:   7% (98/1399)   [K
remote: Compressing objects:   8% (112/1399)   [K
remote: Compressing objects:   9% (126/1399)   [K
remote: Compressing objects:  10% (140/1399)   [K
remote: Compressing objects:  11% (154/1399)   [K
remote: Compressing objects:  12% (168/1399)   [K
remote: Compressing objects:  13% (182/1399)   [K
remote: Compressing objects:  14% (196/1399)   [K
remote: Compressing objects:  15% (210/1399)   [K
remote: Compressing objects:  16% (224/1399)   [K
remote: Compressing objects:  17% (238/1399)   [K
remote: Compressing objects:  18% (252/1399)   [K
remote: Compressing objects:  19% (266/1399)   [K
remote: Compressing objects:  20% (280/1399)   [K
remote: Compressing objects:  21% (294/1399)   [K
remote: Compressing objects:  22% (308/1399)   [K
remote: Compressing objects:  23% (322/1399)   [K
remote: Compressing objects:  24% (336/1399)   [K
remote: Compressing objects:  25% (350/1399)   [K
remote: Compressing objects:  26% (364/1399)   [K
remote: Compressing objects:  27% (378/1399)   [K
remote: Compressing objects:  28% (392/1399)   [K
remote: Compressing objects:  29% (406/1399)   [K
remote: Compressing objects:  30% (420/1399)   [K
remote: Compressing objects:  31% (434/1399)   [K
remote: Compressing objects:  32% (448/1399)   [K
remote: Compressing objects:  33% (462/1399)   [K
remote: Compressing objects:  34% (476/1399)   [K
remote: Compressing objects:  35% (490/1399)   [K
remote: Compressing objects:  36% (504/1399)   [K
remote: Compressing objects:  37% (518/1399)   [K
remote: Compressing objects:  38% (532/1399)   [K
remote: Compressing objects:  39% (546/1399)   [K
remote: Compressing objects:  40% (560/1399)   [K
remote: Compressing objects:  41% (574/1399)   [K
remote: Compressing objects:  42% (588/1399)   [K
remote: Compressing objects:  43% (602/1399)   [K
remote: Compressing objects:  44% (616/1399)   [K
remote: Compressing objects:  45% (630/1399)   [K
remote: Compressing objects:  46% (644/1399)   [K
remote: Compressing objects:  47% (658/1399)   [K
remote: Compressing objects:  48% (672/1399)   [K
remote: Compressing objects:  49% (686/1399)   [K
remote: Compressing objects:  50% (700/1399)   [K
remote: Compressing objects:  51% (714/1399)   [K
remote: Compressing objects:  52% (728/1399)   [K
remote: Compressing objects:  53% (742/1399)   [K
remote: Compressing objects:  54% (756/1399)   [K
remote: Compressing objects:  55% (770/1399)   [K
remote: Compressing objects:  56% (784/1399)   [K
remote: Compressing objects:  57% (798/1399)   [K
remote: Compressing objects:  58% (812/1399)   [K
remote: Compressing objects:  59% (826/1399)   [K
remote: Compressing objects:  60% (840/1399)   [K
remote: Compressing objects:  61% (854/1399)   [K
remote: Compressing objects:  62% (868/1399)   [K
remote: Compressing objects:  63% (882/1399)   [K
remote: Compressing objects:  64% (896/1399)   [K
remote: Compressing objects:  65% (910/1399)   [K
remote: Compressing objects:  66% (924/1399)   [K
remote: Compressing objects:  67% (938/1399)   [K
remote: Compressing objects:  68% (952/1399)   [K
remote: Compressing objects:  69% (966/1399)   [K
remote: Compressing objects:  70% (980/1399)   [K
remote: Compressing objects:  71% (994/1399)   [K
remote: Compressing objects:  72% (1008/1399)   [K
remote: Compressing objects:  73% (1022/1399)   [K
remote: Compressing objects:  74% (1036/1399)   [K
remote: Compressing objects:  75% (1050/1399)   [K
remote: Compressing objects:  76% (1064/1399)   [K
remote: Compressing objects:  77% (1078/1399)   [K
remote: Compressing objects:  78% (1092/1399)   [K
remote: Compressing objects:  79% (1106/1399)   [K
remote: Compressing objects:  80% (1120/1399)   [K
remote: Compressing objects:  81% (1134/1399)   [K
remote: Compressing objects:  82% (1148/1399)   [K
remote: Compressing objects:  83% (1162/1399)   [K
remote: Compressing objects:  84% (1176/1399)   [K
remote: Compressing objects:  85% (1190/1399)   [K
remote: Compressing objects:  86% (1204/1399)   [K
remote: Compressing objects:  87% (1218/1399)   [K
remote: Compressing objects:  88% (1232/1399)   [K
remote: Compressing objects:  89% (1246/1399)   [K
remote: Compressing objects:  90% (1260/1399)   [K
remote: Compressing objects:  91% (1274/1399)   [K
remote: Compressing objects:  92% (1288/1399)   [K
remote: Compressing objects:  93% (1302/1399)   [K
remote: Compressing objects:  94% (1316/1399)   [K
remote: Compressing objects:  95% (1330/1399)   [K
remote: Compressing objects:  96% (1344/1399)   [K
remote: Compressing objects:  97% (1358/1399)   [K
remote: Compressing objects:  98% (1372/1399)   [K
remote: Compressing objects:  99% (1386/1399)   [K
remote: Compressing objects:  99% (1398/1399)   [K
remote: Compressing objects: 100% (1399/1399)   [K
remote: Compressing objects: 100% (1399/1399), done.[K
Receiving objects:   0% (1/2682)   
Receiving objects:   1% (27/2682)   
Receiving objects:   2% (54/2682)   
Receiving objects:   3% (81/2682)   
Receiving objects:   4% (108/2682)   
Receiving objects:   5% (135/2682)   
Receiving objects:   6% (161/2682)   
Receiving objects:   7% (188/2682)   
Receiving objects:   8% (215/2682)   
Receiving objects:   9% (242/2682)   
Receiving objects:  10% (269/2682)   
Receiving objects:  11% (296/2682)   
Receiving objects:  12% (322/2682)   
Receiving objects:  13% (349/2682)   
Receiving objects:  14% (376/2682)   
Receiving objects:  15% (403/2682)   
Receiving objects:  16% (430/2682)   
Receiving objects:  17% (456/2682)   
Receiving objects:  18% (483/2682)   
Receiving objects:  19% (510/2682)   
Receiving objects:  20% (537/2682)   
Receiving objects:  21% (564/2682)   
Receiving objects:  22% (591/2682)   
Receiving objects:  23% (617/2682)   
Receiving objects:  24% (644/2682)   
Receiving objects:  25% (671/2682)   
Receiving objects:  26% (698/2682)   
Receiving objects:  27% (725/2682)   
Receiving objects:  28% (751/2682)   
Receiving objects:  29% (778/2682)   
Receiving objects:  30% (805/2682)   
Receiving objects:  31% (832/2682)   
Receiving objects:  32% (859/2682)   
Receiving objects:  33% (886/2682)   
Receiving objects:  34% (912/2682)   
Receiving objects:  35% (939/2682)   
Receiving objects:  36% (966/2682)   
Receiving objects:  37% (993/2682)   
Receiving objects:  38% (1020/2682)   
Receiving objects:  39% (1046/2682)   
Receiving objects:  40% (1073/2682)   
Receiving objects:  41% (1100/2682)   
Receiving objects:  42% (1127/2682)   
Receiving objects:  43% (1154/2682)   
Receiving objects:  44% (1181/2682)   
Receiving objects:  45% (1207/2682)   
Receiving objects:  46% (1234/2682)   
Receiving objects:  47% (1261/2682)   
Receiving objects:  48% (1288/2682)   
Receiving objects:  49% (1315/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  50% (1341/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  51% (1368/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  52% (1395/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  53% (1422/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  54% (1449/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  55% (1476/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  56% (1502/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  57% (1529/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  58% (1556/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  59% (1583/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  60% (1610/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  61% (1637/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  62% (1663/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  63% (1690/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  64% (1717/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  65% (1744/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  66% (1771/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  66% (1792/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  67% (1797/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  68% (1824/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  69% (1851/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  70% (1878/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  71% (1905/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  72% (1932/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  73% (1958/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  74% (1985/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  75% (2012/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  76% (2039/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  76% (2042/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  77% (2066/2682), 3.11 MiB | 1.52 MiB/s   
Receiving objects:  78% (2092/2682), 4.07 MiB | 1.59 MiB/s   
Corrupted MAC on input.
Disconnecting: Packet corrupt
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.Java:1325)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.Java:1186)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.Java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.Java:257)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.Java:620)
    ... 10 more

Lorsque je lance git fetch --tags --progress [email protected]:ethenwilson/whentoact.git à partir de la ligne de commande, cela fonctionne bien, ce qui signifie que mes clés SSH doivent fonctionner.

Je me connecte à BitBucket avec Jenkins avec la vérification SSH. Jenkins obtient la clé du fichier dans lequel elle se trouve (celle par défaut), donc je sais que Jenkins utilise la même clé que moi lorsque je lance à partir de la ligne de commande.

J'utilise la dernière version des plugins BitBucket et Git pour Jenkins. Mon Git installé sur mon Mac est la version 1.8.5.2 (Apple Git-48).

Ma commande de démarrage de jenkins est Nohup Java -jar ~/jenkins.war --httpPort=8081 --ajp13Port=8010 > /tmp/jenkins.log 2>&1 &.

Qu'est-ce qui ne va pas?

EDIT: je me suis trompé, j'avais accidentellement frappé une option pour que la clé SSH soit au mauvais endroit quand j'ai fait cela. Maintenant, en utilisant la suggestion de @ borrrden, cela donne toujours la même erreur. ** EDIT: Comme @borrrden l’a suggéré, j’ai modifié ma commande de démarrage en Nohup Java -Dorg.jenkinsci.plugins.gitclient.Git.useCLI=true -jar ~/Downloads/jenkins.war --httpPort=8081 --ajp13Port=8010 > /tmp/jenkins.log 2>&1 & et j’obtiens maintenant un plantage différent:

Started by user anonymous
Building in workspace /Users/ethen/.jenkins/workspace/Build NikNik
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.Origin.url [email protected]:ethenwilson/whentoact.git
Fetching upstream changes from [email protected]:ethenwilson/whentoact.git
 > git --version
using GIT_SSH to set credentials NikNik BitBucket SSH Key
 > git fetch --tags --progress [email protected]:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/Origin/*
FATAL: Failed to fetch from [email protected]:ethenwilson/whentoact.git
hudson.plugins.git.GitException: Failed to fetch from [email protected]:ethenwilson/whentoact.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.Java:622)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.Java:854)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.Java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.Java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.Java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.Java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.Java:530)
    at hudson.model.Run.execute(Run.Java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.Java:43)
    at hudson.model.ResourceController.execute(ResourceController.Java:88)
    at hudson.model.Executor.run(Executor.Java:234)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress [email protected]:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/Origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.Java:1406)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.Java:1194)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.Java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.Java:265)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.Java:620)
    ... 10 more
16
E.A. Wilson

 enter image description here 1) Aller à la configuration du travail 

2) Allez à la section "Gestion du code source"

3) Comportements supplémentaires> ajouter 

4) Sélectionnez "Effacer le référentiel et forcer le clone" 

Cela supprimera et ne clonera à nouveau que l'espace de travail qui convient à votre travail. Si vous souhaitez confirmer avant de supprimer, je suggère alors d'exclure la variable $ WORKSPACE via une étape de construction de la commande batch/bash. 

De plus, cela ralentit beaucoup la compilation, je suggère donc de la supprimer après une compilation.

3
Janac Meena

Cela ressemble à une erreur de réseau:

Réception d'objets: 78% (2092/2682), 4,07 Mio | 1,59 Mio/s

MAC corrompu en entrée. 

Déconnexion: paquet corrompu 

fatal: l'extrémité distante a raccroché de manière inattendue 

fatal: tôt EOF 

fatal: échec de l'index-pack

suggère que le réseau a brisé à 78% du chemin.

Semble être un problème - commun.

2
gbjbaanb

J'ai également eu ce problème et je n'ai pu le résoudre qu'en en supprimant l'espace de travail du référentiel posant problème sur notre serveur maître Jenkins.

Je pense que le problème était qu’il y avait une erreur de connexion (comme @gbjbaanb) dans quelques versions (notre Bitbucket est tombé en panne). Cela a laissé l’espace de travail du maître dans un état corrompu et, étant donné que Jenkins essaie d’utiliser les espaces de travail en cache dans la mesure du possible, toutes les générations suivantes ont également échoué.

2
meonlol

Pour moi, cela correspondait au délai d'expiration par défaut de 10 minutes pour le plugin git-client . Résolu en définissant un comportement de clonage avancé sur le travail et en augmentant le délai . Les connaissances acquises ici: https: // .jenkins-ci.org/browse/JENKINS-20445? FocusCommentId = 195638 & page = com.atlassian.jira.plugin.system.issuetabpanels: commentaire-onglet # comment-195638

2
Dan Caseley

Ce problème est probablement dû à une vérification de dépassement de délai en cours lors de la récupération. Vous pouvez l'augmenter en suivant les conseils mentionnés ci-dessous.

Dans la page de configuration du travail, dans la section du plug-in Git, vous trouverez une liste déroulante "Ajouter". Dans cette liste déroulante, il y a une sélection "Comportements de clonage avancés". Lorsque vous ajoutez les comportements de clonage avancés, un champ apparaît dans le champ "Délai d'attente (en minutes) pour l'opération de clonage et de récupération".

1
Sadiq Ali