简体   繁体   English

即使在尝试了多种方式后,GitLab 管道也经常失败

[英]GitLab pipeline fails frequently even after trying in many ways

I was just trying to work with GitLab CI/CD.我只是想使用 GitLab CI/CD。 I created a test angular project which had only one component, and worked fine.我创建了一个只有一个组件的测试 angular 项目,并且运行良好。 Then I started the GitLab Runner in that project.然后我在那个项目中启动了 GitLab Runner。 Added a .yml file to run the project.添加了一个 .yml 文件来运行项目。 But the pipeline failed all the time.但是管道一直失败。 Then for testing purpose, I removed all the scripts for running the project, and just added some echo statements.然后出于测试目的,我删除了运行项目的所有脚本,只添加了一些 echo 语句。 Even then my pipeline failed.即便如此,我的管道也失败了。 It is showing that它表明

& : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. & :术语“git”不被识别为 cmdlet、函数、脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

Screenshot of yml script yml 脚本截图

在此处输入图片说明

Error message showed in GitLab GitLab 中显示的错误消息

在此处输入图片说明

This is because git is not available in your runner path.这是因为 git 在您的跑步者路径中不可用。

  1. Make sure Git is installed in your runner确保在您的跑步者中安装了 Git
before_script:
  - apt-get install git-core
  1. If installed try restarting the runner instance如果已安装,请尝试重新启动运行器实例

Issue Links-问题链接-

  1. https://gitlab.com/gitlab-org/gitlab-runner/issues/2743 https://gitlab.com/gitlab-org/gitlab-runner/issues/2743

  2. Git is not recognized in Windows gitlab ci 在 Windows gitlab ci 中无法识别 Git

I uninstalled my git and reinstalled it.我卸载了我的 git 并重新安装了它。 The location I provided for environment path was different, than the one in which the git was actually installed at.我为环境路径提供的位置与实际安装 git 的位置不同。 Hence, when I reinstalled it, it got automatically installed into my C drive(this was the environment path I had set, I got this path while I was searching for solutions in net).因此,当我重新安装它时,它会自动安装到我的 C 驱动器中(这是我设置的环境路径,我在网上搜索解决方案时得到了这个路径)。 I had not cross checked, whether actually my git location was C or not.我没有交叉检查,实际上我的 git 位置是否是 C。 I thought it might have been saved in C itself, but it was actually saved in some other location.我认为它可能已经保存在 C 本身中,但它实际上保存在其他位置。

After installing the git from git-scm.com you must restart the gitlab-runner service.git-scm.com安装git ,您必须重新启动gitlab-runner服务。

I had problem in windows server and eventually become fixed :)我在 Windows 服务器上遇到了问题,最终得到修复 :)

# gitlab-runner stop
# gitlab-runner start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM