未找到带有Docker executor/usr/bin/bash的Gitlab CI:第90行:git:命令

未找到带有Docker executor/usr/bin/bash的Gitlab CI:第90行:git:命令,gitlab,gitlab-ci,gitlab-ci-runner,Gitlab,Gitlab Ci,Gitlab Ci Runner,我有一个本地gitlab服务器和带有docker executor的gitlab ci runner 我想使用gitlab ci构建(第一阶段)我的maven项目。 由于我使用buildnumber maven插件,我在gitlab-ci.yml中添加了一个git服务,如下所示: image: maven:latest services: - alpine/git:latest # Cache goes here cache: paths: - .m2/repository

我有一个本地gitlab服务器和带有docker executor的gitlab ci runner

我想使用gitlab ci构建(第一阶段)我的maven项目。 由于我使用buildnumber maven插件,我在gitlab-ci.yml中添加了一个git服务,如下所示:

image: maven:latest

services:
  - alpine/git:latest

# Cache goes here
cache:
  paths:
    - .m2/repository
    - frontend-app/node_modules/

# ENV variables goes  here

# Before script goes here

# Stages definition goes here
stages:
  - build

# Build stage
build:
  stage: build
  before_script:
    - mvn --version
    - git --version
  script:
    - mvn clean install --settings .ci/settings.xml
  artifacts:
    paths:
      - backend-app/target/*.jar
但是当执行
git--version
时,我得到了
命令notfound错误
。 这是我完整的gitlab ci控制台日志:

Running with gitlab-runner 12.9.0 (4c96e5ad)
   on securteck jrEY4-V2
Preparing the "docker" executor
 Using Docker executor with image maven:latest ...
 Starting service alpine/git:latest ...
 Pulling docker image alpine/git:latest ...
 Using docker image sha256:fe3295a34a932155290fdbba14d770c11f3dfe0e1e732d8e355cecbeec59e877 for alpine/git:latest ...
 Waiting for services to be up and running...
 *** WARNING: Service runner-jrEY4-V2-project-1-concurrent-0-alpine__git-0 probably didn't start properly.
 Health check error:
 ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-jrEY4-V2-project-1-concurrent-0-alpine__git-0 AS /runner-jrEY4-V2-project-1-concurrent-0-alpine__git-0-wait-for-service/service (docker.go:1322:0s)
 Service container logs:
 2020-04-10T19:05:54.826814609Z usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
 2020-04-10T19:05:54.826879457Z            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
 2020-04-10T19:05:54.826895945Z            [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
 2020-04-10T19:05:54.826910244Z            [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
 2020-04-10T19:05:54.826923359Z            <command> [<args>]
 2020-04-10T19:05:54.826935482Z 
 2020-04-10T19:05:54.826947063Z These are common Git commands used in various situations:
 2020-04-10T19:05:54.826959005Z 
 2020-04-10T19:05:54.826971038Z start a working area (see also: git help tutorial)
 2020-04-10T19:05:54.826982664Z    clone     Clone a repository into a new directory
 2020-04-10T19:05:54.826994349Z    init      Create an empty Git repository or reinitialize an existing one
 2020-04-10T19:05:54.827006426Z 
 2020-04-10T19:05:54.827017832Z work on the current change (see also: git help everyday)
 2020-04-10T19:05:54.827029626Z    add       Add file contents to the index
 2020-04-10T19:05:54.827040891Z    mv        Move or rename a file, a directory, or a symlink
 2020-04-10T19:05:54.827052743Z    restore   Restore working tree files
 2020-04-10T19:05:54.827064196Z    rm        Remove files from the working tree and from the index
 2020-04-10T19:05:54.827075878Z 
 2020-04-10T19:05:54.827087305Z examine the history and state (see also: git help revisions)
 2020-04-10T19:05:54.827099305Z    bisect    Use binary search to find the commit that introduced a bug
 2020-04-10T19:05:54.827111245Z    diff      Show changes between commits, commit and working tree, etc
 2020-04-10T19:05:54.827125099Z    grep      Print lines matching a pattern
 2020-04-10T19:05:54.827137183Z    log       Show commit logs
 2020-04-10T19:05:54.827149113Z    show      Show various types of objects
 2020-04-10T19:05:54.827160630Z    status    Show the working tree status
 2020-04-10T19:05:54.827172589Z 
 2020-04-10T19:05:54.827183674Z grow, mark and tweak your common history
 2020-04-10T19:05:54.827195529Z    branch    List, create, or delete branches
 2020-04-10T19:05:54.827207168Z    commit    Record changes to the repository
 2020-04-10T19:05:54.827218764Z    merge     Join two or more development histories together
 2020-04-10T19:05:54.827230406Z    rebase    Reapply commits on top of another base tip
 2020-04-10T19:05:54.827241931Z    reset     Reset current HEAD to the specified state
 2020-04-10T19:05:54.827253929Z    switch    Switch branches
 2020-04-10T19:05:54.827265678Z    tag       Create, list, delete or verify a tag object signed with GPG
 2020-04-10T19:05:54.827277537Z 
 2020-04-10T19:05:54.827300897Z collaborate (see also: git help workflows)
 2020-04-10T19:05:54.827314706Z    fetch     Download objects and refs from another repository
 2020-04-10T19:05:54.827327136Z    pull      Fetch from and integrate with another repository or a local branch
 2020-04-10T19:05:54.827339235Z    push      Update remote refs along with associated objects
 2020-04-10T19:05:54.827351266Z 
 2020-04-10T19:05:54.827362364Z 'git help -a' and 'git help -g' list available subcommands and some
 2020-04-10T19:05:54.827374869Z concept guides. See 'git help <command>' or 'git help <concept>'
 2020-04-10T19:05:54.827387595Z to read about a specific subcommand or concept.
 2020-04-10T19:05:54.827401411Z See 'git help git' for an overview of the system.
 *********
 Pulling docker image maven:latest ...
 Using docker image sha256:32cd4e857a56c5cfddaafaebc877764e2547e7bc23b4bc63cfc6a163c4ee3361 for maven:latest ...
Preparing environment
00:02
 Running on runner-jrEY4-V2-project-1-concurrent-0 via PAR-174582...
Getting source from Git repository
00:03
 Fetching changes with git depth set to 50...
 Reinitialized existing Git repository in /builds/securteck/securteck/.git/
 From http://195.154.233.19:8000/securteck/securteck
  * [new ref]         refs/pipelines/29 -> refs/pipelines/29
    b8a890e..17b4d1c  develop           -> origin/develop
 Checking out 17b4d1cd as develop...
 Skipping Git submodules setup
Restoring cache
00:02
 Checking cache for default-4...
 No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
 Successfully extracted cache
Downloading artifacts
00:02
Running before_script and script
00:02
 $ mvn --version
 Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
 Maven home: /usr/share/maven
 Java version: 14, vendor: Oracle Corporation, runtime: /usr/java/openjdk-14
 Default locale: en_US, platform encoding: UTF-8
 OS name: "linux", version: "4.15.0-76-generic", arch: "amd64", family: "unix"
 $ git --version
 /usr/bin/bash: line 90: git: command not found
Running after_script
00:02
Uploading artifacts for failed job
00:02
 ERROR: Job failed: exit code 1
使用gitlab runner 12.9.0(4c96e5ad)运行
关于securteck jrEY4-V2
准备“docker”执行器
使用Docker executor与图像maven:latest。。。
正在启动服务alpine/git:最新。。。
正在提取docker图像alpine/git:最新。。。
使用docker映像sha256:fe3295a34a932155290fdbba14d770c11f3dfe0e1e732d8e355cecbeec59e877用于alpine/git:最新。。。
正在等待服务启动并运行。。。
***警告:服务运行程序-jrEY4-V2-project-1-concurrent-0-alpine__git-0可能没有正确启动。
运行状况检查错误:
ContainerStart:守护程序的错误响应:无法链接到非运行的容器:/runner-jrEY4-V2-project-1-concurrent-0-alpine__git-0 AS/runner-jrEY4-V2-project-1-concurrent-0-alpine__git-0-wait-for-service/service(docker.go:1322:0s)
服务容器日志:
2020-04-10T19:05:54.826814609Z用法:git[--version][--help][-C][C=]
2020-04-10T19:05:54.826879457Z[--exec path[=][--html path][--man path][--info path]
2020-04-10T19:05:54.826895945Z[-p|--paginate[p|--p|--no pager][--no replace objects][--bare]
2020-04-10T19:05:54.826910244Z[--git dir=][--work tree=][--namespace=]
2020-04-10T19:05:54.826923359Z[]
2020-04-10T19:05:54.826935482Z
2020-04-10T19:05:54.826947063Z这些是在各种情况下使用的常见Git命令:
2020-04-10T19:05:54.826959005Z
2020-04-10T19:05:54.826971038Z启动工作区(另请参见:git帮助教程)
2020-04-10T19:05:54.826982664Z克隆将存储库克隆到新目录中
2020-04-10T19:05:54.826994349Z初始化创建一个空的Git存储库或重新初始化现有的Git存储库
2020-04-10T19:05:54.827006426Z
2020-04-10T19:05:54.827017832Z处理当前更改(另请参见:git帮助每日)
2020-04-10T19:05:54.827029626Z将文件内容添加到索引
2020-04-10T19:05:54.827040891Z移动或重命名文件、目录或符号链接
2020-04-10T19:05:54.827052743Z恢复工作树文件
2020-04-10T19:05:54.827064196Z rm从工作树和索引中删除文件
2020-04-10T19:05:54.827075878Z
2020-04-10T19:05:54.827087305Z检查历史和状态(另请参见:git帮助修订版)
2020-04-10T19:05:54.827099305Z对分使用二进制搜索查找引入错误的提交
2020-04-10T19:05:54.827111245Z差异显示提交、提交和工作树等之间的更改
2020-04-10T19:05:54.827125099Z与图案匹配的grep打印线
2020-04-10T19:05:54.827137183Z日志显示提交日志
2020-04-10T19:05:54.827149113Z显示各种类型的对象
2020-04-10T19:05:54.827160630Z状态显示工作树状态
2020-04-10T19:05:54.827172589Z
2020-04-10T19:05:54.827183674Z增长、标记和调整你的共同历史
2020-04-10T19:05:54.827195529Z分支列表、创建或删除分支
2020-04-10T19:05:54.827207168Z将记录更改提交到存储库
2020-04-10T19:05:54.827218764Z合并将两个或多个开发历史合并在一起
2020-04-10T19:05:54.827230406Z重基在另一个基端顶部重新应用提交
2020-04-10T19:05:54.827241931Z重置当前磁头至指定状态
2020-04-10T19:05:54.827253929Z开关支路
2020-04-10T19:05:54.827265678Z标记创建、列出、删除或验证用GPG签名的标记对象
2020-04-10T19:05:54.827277537Z
2020-04-10T19:05:54.827300897Z协作(另请参见:git帮助工作流)
2020-04-10T19:05:54.827314706Z从另一个存储库获取下载对象和引用
2020-04-10T19:05:54.827327136Z从另一个存储库或本地分支拉取并与之集成
2020-04-10T19:05:54.827339235Z推送更新远程引用以及相关对象
2020-04-10T19:05:54.827351266Z
2020-04-10T19:05:54.827362364Z'git help-a'和'git help-g'列出可用的子命令和一些
2020-04-10T19:05:54.827374869Z概念指南。请参阅“git帮助”或“git帮助”
2020-04-10T19:05:54.827387595Z阅读特定子命令或概念。
2020-04-10T19:05:54.827401411Z有关系统的概述,请参阅“git帮助git”。
*********
正在提取docker图像maven:最新。。。
正在为maven使用docker映像sha256:32CD4E857A56C5CFDDAAAFAEBC877764E2547E7BC23B4BC63C6A163C4EE3361:最新。。。
准备环境
00:02
通过PAR-174582在runner-jrEY4-V2-project-1-concurrent-0上运行。。。
从Git存储库获取源代码
00:03
正在获取git深度设置为50的更改。。。
在/builds/securteck/securteck/.Git中重新初始化现有Git存储库/
从…起http://195.154.233.19:8000/securteck/securteck
*[新参考文献]参考文献/管道/29->参考文献/管道/29
b8a890e..17b4d1c开发->来源/开发
正在签出17b4d1cd作为开发。。。
正在跳过Git子模块安装程序
恢复缓存
00:02
正在检查缓存中的默认值-4。。。
未提供URL,将不会从共享缓存服务器下载缓存。相反,将提取缓存的本地版本。
已成功提取缓存
下载工件
00:02
在脚本和脚本之前运行
00:02
$mvn—版本
Apache Maven 3.6.3(cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home:/usr/share/Maven
Java版本:14,供应商:Oracle公司,运行时:/usr/Java/openjdk-14
默认区域设置:en_US,平台编码:UTF-8
操作系统名称:“linux”,版本:“4.15.0-76-generic”,arch:“amd64”,系列:“unix”
$git—版本
/usr/bin/bash:line 90:git:command no
image: maven:latest

myjob:
  script:
  - yum install -y git
  - git --version
$ git --version
 git version 1.8.3.1