在Jenkins项目中加载私有存储库子模块 [英] Loading private repository submodules in Jenkins Project

查看:318
本文介绍了在Jenkins项目中加载私有存储库子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


克隆项目并且它是子模块
  • li>按照使用部署密钥配置为Github私有存储库验证Jenkins配置项



  • 这是我从詹金斯控制台的输出..很明显,插件试图使用直接项目名称..这是

     由用户'__'开始
    在工作区/ var / lib / jenkins中构建/ workspace / JENKINSPROJECTNAME
    > git rev-parse --is-inside-work-tree#timeout = 10
    从远程Git仓库获取更改
    > github-deploy-project:Owner / ProjectName#timeout = 10
    从github-deploy-project获取上游更改:Owner / ProjectName
    > git --version#timeout = 10
    使用GIT_SSH设置凭证
    > git fetch --tags --progress github-deploy-project:Owner / ProjectName + refs / heads / *:refs / remotes / ProjectName / *
    > git rev-parse refs / remotes / ProjectName / master ^ {commit}#timeout = 10
    > git rev-parse refs / remotes / ProjectName / ProjectName / master ^ {commit}#timeout = 10
    检出版本______________(refs / remotes / ProjectName / master)
    > git config core.sparsecheckout#timeout = 10
    > git checkout -f _____________
    > git rev-list ________________#timeout = 10
    > git remote#timeout = 10
    > git子模块init#timeout = 10
    > git submodule sync#timeout = 10
    > git config --get remote.ProjectName.url#timeout = 10
    > git submodule update --init --recursive
    FATAL:命令git submodule update --init --recursive返回状态码1:
    stdout:
    stderr:克隆到'submodule / FolderName '...
    remote:无效的用户名或密码。
    致命:'https://github.com/Owner/SubModuleProject.git/'
    身份验证失败'https://github.com/Owner/SubModuleProject.git'克隆到子模块路径' submodule / FolderName'失败

    hudson.plugins.git.GitException:命令git submodule update --init --recursive返回状态码1:
    stdout:
    stderr:克隆到'submodule / FolderName'...
    remote:无效的用户名或密码。
    致命:'https://github.com/Owner/SubModuleProject.git/'
    身份验证失败'https://github.com/Owner/SubModuleProject.git'克隆到子模块路径'子模块/文件夹名称在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1407)
    。在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access $ 400失败

    ( CliGitAPIImpl.java:87)
    在org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 6.execute(CliGitAPIImpl.java:742)
    在hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption的.java:77)在hudson.plugins.git.GitSCM.checkout(GitSCM.java:920
    )中在hudson.model.AbstractProject.checkout(AbstractProject.java:1252

    。在hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
    在jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    在hudson.model.AbstractBuild $ AbstractBuildExecution.run(一个bstractBuild.java:524)在hudson.model.Run.execute(Run.java:1706
    )在hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43

    公司Hudson .model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:232)


    解决方案

    Git正在递归地获取在主项目底部的.gitmodules中定义的回购。



    您有多种方法可以解决这个问题:


    • 更改.gitmodules以指定要求的
      访问控制。

    • 分叉github仓库,并更改所需的访问权限
      控件。

    • 删除.submodule中的条目,并将其复制到
      主仓库中。

    • 如果您控制有问题的github回购,请配置
      〜jenkins / .ssh / config IdentityFile

    I'm currently stuck trying to get Jenkins to

    Here is my output from Jenkins Console.. it's obvious the plugin is attempting to use the straight project name.. which is not setup to use the key.

      Started by user '__'
    Building in workspace /var/lib/jenkins/workspace/JENKINSPROJECTNAME
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.PROJECTREPO.url github-deploy-project:Owner/ProjectName # timeout=10
    Fetching upstream changes from github-deploy-project:Owner/ProjectName
     > git --version # timeout=10
    using GIT_SSH to set credentials 
     > git fetch --tags --progress github-deploy-project:Owner/ProjectName +refs/heads/*:refs/remotes/ProjectName/*
     > git rev-parse refs/remotes/ProjectName/master^{commit} # timeout=10
     > git rev-parse refs/remotes/ProjectName/ProjectName/master^{commit} # timeout=10
    Checking out Revision ______________ (refs/remotes/ProjectName/master)
     > git config core.sparsecheckout # timeout=10
     > git checkout -f _____________
     > git rev-list ________________ # timeout=10
     > git remote # timeout=10
     > git submodule init # timeout=10
     > git submodule sync # timeout=10
     > git config --get remote.ProjectName.url # timeout=10
     > git submodule update --init --recursive
    FATAL: Command "git submodule update --init --recursive" returned status code 1:
    stdout: 
    stderr: Cloning into 'submodule/FolderName'...
    remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/Owner/SubModuleProject.git/'
    Clone of 'https://github.com/Owner/SubModuleProject.git' into submodule path 'submodule/FolderName' failed
    
    hudson.plugins.git.GitException: Command "git submodule update --init --recursive" returned status code 1:
    stdout: 
    stderr: Cloning into 'submodule/FolderName'...
    remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/Owner/SubModuleProject.git/'
    Clone of 'https://github.com/Owner/SubModuleProject.git' into submodule path 'submodule/FolderName' failed
    
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1407)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:87)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$6.execute(CliGitAPIImpl.java:742)
        at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:77)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:920)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
        at hudson.model.Run.execute(Run.java:1706)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:232)
    

    解决方案

    Git is recursively fetching the repos defined in .gitmodules at the base of the main project.

    You have a couple of ways to attack this:

    • Change .gitmodules to refer to a copy of the repo with required access controls.
    • Fork the github repo, and change the required access controls.
    • Remove the entry in .submodule and instead copy it into the main repo.
    • If you control the github repo in question, configure ~jenkins/.ssh/config IdentityFile

    这篇关于在Jenkins项目中加载私有存储库子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆