首页 > 解决方案 > 带有 git 私有仓库的 Jenkins kubernetes 插件

问题描述

我正在尝试使用jenkins kubernetes 插件Gitlab 分支源插件,以及 Kubernetes 集群在我的集群中进行构建。我成功地使管道与公共存储库一起工作,但是当我尝试在我的 SCM 中使用私有存储库时,代理 pod(带有默认的 jnlp 容器)无法针对我的 git 服务器进行身份验证。如何将凭据从 Jenkins 控制器传递到代理 pod?

管道日志:

The recommended git tool is: git
Warning: CredentialId "b4f86bce-18c3-4758-972d-5907e601efd0" could not be found.
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://gitlab.mycompany.eu/myuser/myproject.git
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress -- https://gitlab.mycompany.eu/myuser/myproject.git +refs/heads/feature-jenkins-deployment:refs/remotes/origin/feature-jenkins-deployment" returned status code 128:
stdout: 
stderr: remote: HTTP Basic: Access denied

标签: gitgithubjenkinsgitlab

解决方案


如果我直接在项目上设置凭据,而不是依赖全局配置,它可以无缝工作。


推荐阅读