【问题标题】:jenkins not uploading files from git to Workspace詹金斯没有将文件从 git 上传到工作区
【发布时间】:2021-10-29 14:58:53
【问题描述】:

我确实花了一个小时为我的问题找到解决方案,但我没能找到。 我正在使用 Jenkins 进行一些测试,并在未来将我的项目部署到 AWS。

现在我在 Jenkins 中的 git 配置看起来不错。我有指向我的 github 存储库的链接。 但是当我使用“立即构建”并实际成功构建作业时,但是当我检查日志时,它会向我显示:

Started by user unknown or anonymous
Running as SYSTEM
Building in workspace C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git
The recommended git tool is: NONE
using credential MyGit
Cloning the remote Git repository
Cloning repository https://github.com/NeoVic2006/Summit_project
 > git.exe init C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git # timeout=10
Fetching upstream changes from https://github.com/NeoVic2006/Summit_project
 > git.exe --version # timeout=10
 > git --version # 'git version 2.32.0.windows.2'
using GIT_ASKPASS to set credentials 
 > git.exe fetch --tags --force --progress -- https://github.com/NeoVic2006/Summit_project +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git.exe config remote.origin.url https://github.com/NeoVic2006/Summit_project # timeout=10
 > git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 > git.exe rev-parse "refs/remotes/origin/main^{commit}" # timeout=10
Checking out Revision bb6a87a950e251b83d44296b0d230317ec43056c (refs/remotes/origin/main)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f bb6a87a950e251b83d44296b0d230317ec43056c # timeout=10
ERROR: Unable to retrieve commit message
org.eclipse.jgit.errors.MissingObjectException: Missing unknown bb6a87a950e251b83d44296b0d230317ec43056c
    at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
    at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:212)
    at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1065)
    at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:975)
    at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:25)
    at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:13)
    at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:86)
    at hudson.plugins.git.GitSCM.printCommitMessageToLog(GitSCM.java:1397)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1363)
    at hudson.scm.SCM.checkout(SCM.java:505)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1211)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:636)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:508)
    at hudson.model.Run.execute(Run.java:1906)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
 > git.exe rev-list --no-walk bb6a87a950e251b83d44296b0d230317ec43056c # timeout=10
[test_git] $ cmd.exe /c call C:\Windows\TEMP\shiningpanda2252295568321242739.bat

C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git>python --version  
Python 3.9.7

C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\test_git>exit 0 
Finished: SUCCESS

我有这个错误“错误:无法检索提交消息”并且我在工作区中没有任何文件。

我确实尝试重新安装 jenkins,我确实尝试将新的 Commit 推送到 github,但仍然出现同样的错误。

有什么办法解决吗?

请具体说明,如果您决定给我链接到另一个 Stackoverflow 问题,请确保它是相同的问题。

谢谢你, 谢尔盖

【问题讨论】:

    标签: python github jenkins


    【解决方案1】:

    我找到了解决方案。问题在于 Jenkins 的根文件夹。而且我怀疑 Jenkins 中的某些项目在我重新安装 Jenkins 后无法正常工作。 所以我所做的是从 PC 中删除所有 Jenkins 文件并从头开始重新安装:

    如何从 PC 上完全删除:

    Open Windows Control Panel and click Programs and Features
    Right-click Jenkins x.xxx.x (where x.xxx.x, is the Jenkins version), and select Uninstall.
    Follow the directions.
    When done, delete the following folders: (note: DO NOT remove the jenkins.jenkins or jenkinswar folders if you want to keep the projects and plugins.)
    
    C:\Program Files\Jenkins or C:\Program Files(x86)\Jenkins 
    C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins.jenkins 
    C:\Windows\System32\config\systemprofile\AppData\Local\Jenkinswar
    
    Restart the computer.
    

    在那之后,我确实在 Jenkins 中重新创建了我的项目,现在一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-29
      • 2017-03-02
      • 2015-07-25
      • 2022-09-27
      • 1970-01-01
      • 1970-01-01
      • 2017-11-22
      • 1970-01-01
      相关资源
      最近更新 更多