2016-12-23 19 views
0

対応するプラグインを使用してgitリポジトリをクローンするJenkinsを設定しようとしています。資格情報を使用しているときにJenkins git認証が失敗する

しかし、私は理由はわかりませんが、認証しようとすると失敗します。

Iはジェンキンスを介して認証情報を定義しようとしたが、それは失敗:

Building in workspace /var/lib/jenkins/workspace/CLARA 
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> /usr/bin/git config remote.origin.url https://hola.int/git-repos/ # timeout=10 
Fetching upstream changes from https://hola.int/git-repos/ 
> /usr/bin/git --version # timeout=10 
using GIT_ASKPASS to set credentials Access to CLARA 
Setting http proxy: proxy.es:80 
> /usr/bin/git fetch --tags --progress https://hola.int/git-repos/ +refs/heads/*:refs/remotes/origin/* 
ERROR: Error fetching remote repo 'origin' 
hudson.plugins.git.GitException: Failed to fetch from https://hola.int/git-repos/ 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803) 
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) 
at hudson.scm.SCM.checkout(SCM.java:495) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 
at hudson.model.Run.execute(Run.java:1729) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:404) 
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://hola.int/git-repos/ +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: fatal: Authentication failed for 'https://hola.int/git-repos/' 

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801) 
... 11 more 

Iはまた、資格情報を空にし、ユーザーが挙げ/リポジトリにgitのパスを渡す残すことを試みたが、それはまた失敗:

Building in workspace /var/lib/jenkins/workspace/CLARA 
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> /usr/bin/git config remote.origin.url https://XXXX:[email protected]/git-repos/ # timeout=10 
Fetching upstream changes from https://[email protected]/git-repos/ 
> /usr/bin/git --version # timeout=10 
Setting http proxy: proxy.es:80 
> /usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 
ERROR: Error fetching remote repo 'origin' 
hudson.plugins.git.GitException: Failed to fetch from https://[email protected]/git-repos/ 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803) 
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) 
at hudson.scm.SCM.checkout(SCM.java:495) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 
at hudson.model.Run.execute(Run.java:1729) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:404) 
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: fatal: Authentication failed for 'https://[email protected]/git-repos/' 

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801) 
... 11 more 

しかし、私がジェンキンスノードのリポジトリを自分で複製しようとすると、それは動作します。ジェンキンスは何をしているのですか:

git config --global http.proxy http://proxy.es:80 
/usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 

私はパスワードを尋ねて失敗することなく続けます。パスを使用して

も動作します:

git config --global http.proxy http://proxy.es:80 
/usr/bin/git fetch --tags --progress https://XXXX:[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 

マイネットは、プロキシの下にあります。しかし、私は既にJenkinsにプロキシの詳細を含めておき、gitプラグインはそれを使用することになっています。

ジェンキンスのバージョンは2.37で、gitプラグイン3.0.1です。

ビルドは、Dockerプラグインを使用してDockerコンテナ内で行われます。しかし、私はそれが重要ではないと思う。私はドッカーなしで同じ問題を抱えています。私が前にチェックしたのは、ドッカーの画像にコンテナを作成して、ジェンキンスのことを正確に再現することでした。

ご協力いただきありがとうございます。

+0

デバッグが難しい。しかし、http://だけでなく、git pluginにもhttps_proxy = http://proxy.es:80を指定する必要があります。ただし、失敗した認証エラーは変です。 – lvthillo

+0

ありがとうございますが、gitプラグインのプロキシオプションを指定する方法がわかりません。 – cardogar

+0

事務所の代理人の問題であったため、投稿が閉鎖されました。 –

答えて

1

ジェンキンの資格情報とgit資格情報が同じ場合は失敗します。ジェンキンス資格情報を変更します。

+0

あなたの提案をありがとう。私はあなたが何を意味するのか完全に理解していません。 'https:// XXXX:YYYY @ hola.int/git-repos /'を介してgit資格情報を使用すると、ジョブの設定でjenkinsの資格情報を無効にします(オプション-none-を選択します)。私はgitグローバル設定変数をjenkinsマシンに設定できません。私はjenkinsの設定(私はそれをテストした)を無視するので、私はそれを動作させるが、私は私のDockerイメージで "ハードコード"することはできません。 – cardogar

関連する問題