LoginSignup
2
0

More than 5 years have passed since last update.

Jenkinsではまったエラー

Last updated at Posted at 2017-11-30

ERROR: Error fetching remote repo 'origin'

Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/WebDriverTest
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:zakki1206/cook-project.git # timeout=10
Fetching upstream changes from git@bitbucket.org:zakki1206/cook-project.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@bitbucket.org:zakki1206/cook-project.git +refs/heads/*:refs/remotes/origin/* # timeout=30
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:zakki1206/cook-project.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1202)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
    at hudson.model.Run.execute(Run.java:1727)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:zakki1206/cook-project.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
    ... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

原因

bitbucketに登録した公開鍵の秘密鍵のパスが正しくなかった。

/root/.ssh 配下の鍵を/var/lib/jenkins/.ssh 配下にコピー


[root@tk2-408-45235 /]# ls -la /var/lib/jenkins/.ssh/
total 20
drwxr-xr-x  2 jenkins root    4096 Nov 30 19:50 .
drwxr-xr-x 15 jenkins jenkins 4096 Nov 30 19:50 ..
-rw-------  1 jenkins jenkins 1743 Nov 30 19:50 id_rsa
-rw-r--r--  1 jenkins jenkins  416 Nov 30 19:50 id_rsa.pub
-rw-r--r--  1 jenkins jenkins 1199 Nov 30 15:43 known_hosts

ビルドシェルの実行でsudoが使えない

sudo: /bin/sudo must be owned by uid 0 and have the setuid bit set

やったこと

Jenkinsでsudo実行可能設定

    sudo visudo

下記を変更

    # Defaults !visiblepw
    Defaults visiblepw

下記を追加

    root    ALL=(ALL:ALL) ALL
    jenkins ALL=(ALL) NOPASSWD:ALL

jenkins リスタート

    service jenkins restart

回避

解決できなかったので
cronで行うことで回避した

どなたか心当たりがあれば教えてください。。。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0