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

梅德凯利菲

我有一个本地gitlab服务器和带有docker executor的gitlab-ci运行程序。

我想使用gitlab-ci来构建(第一阶段)我的maven项目。因为我使用buildnumber-maven-plugin,所以我向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被执行时我得到了command not found error这是我完整的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
亚历山大·沙洛里欣

如果愿意,可以安装gitmaven容器中。示例(存根).gitlab-ci.yml

image: maven:latest

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

从CI作业日志中:

$ git --version
 git version 1.8.3.1

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

gitlab ci无法使用shell执行器找到docker buildx命令

来自分类Dev

Gitlab CI 中的 Docker 执行器将错误的 url 传递给 Git 存储库

来自分类Dev

#!/usr/bin/python 行有什么作用?

来自分类Dev

-bash:/ usr / bin / yum:/ usr / bin / python:错误的解释器:没有这样的文件或目录

来自分类Dev

从/ usr / bin删除git

来自分类Dev

Docker-compose:/ usr / local / bin / docker-compose:第1行:否:找不到命令

来自分类Dev

Cronjob执行`/ usr / bin / python`而不执行`usr / bin / xrdb`

来自分类Dev

从/ usr / bin / env或/ bin启动bash

来自分类Dev

无法从usr / bin运行命令

来自分类Dev

将现有命令的别名版本放在/ usr / bin /

来自分类Dev

bash:/ usr / bin / ruby:没有这样的文件或目录

来自分类Dev

键盘配置:/usr/local/bin/setupcon:900:/usr/local/bin/setupcon:/usr/local/bin/ckbcomp:未找到

来自分类Dev

第1行:?#!/ usr / bin / sh:在尝试执行Shell脚本时找不到

来自分类Dev

Ubuntu&PostgreSQL第24行:/usr/local/bin/psql.bin:没有这样的文件或目录

来自分类Dev

Shell执行:时间与/ usr / bin / time

来自分类Dev

为什么“ / usr / bin / env bash -x”仅在命令行中有效?

来自分类Dev

/ usr / bin / alternatives命令引发用法错误

来自分类Dev

/ usr / bin / alternatives命令引发用法错误

来自分类Dev

/usr/bin/script 不回显任何命令

来自分类Dev

/usr/bin/expect 内联多行命令

来自分类Dev

在CentO上删除了/ usr / bin / docker

来自分类Dev

bash: /usr/bin/ruby: No such file or directory

来自分类Dev

包含与号的bash脚本的/ usr / bin / time

来自分类Dev

bash:/ usr / bin / lein:权限被拒绝

来自分类Dev

终端开始给错误bash:/ usr / bin / lesspipe

来自分类Dev

BASH脚本在/ usr / bin中查找

来自分类Dev

VS Code 找不到 /usr/bin/bash

来自分类Dev

-bash:./conn.sh:/ usr / bin / bash:错误的解释器:没有这样的文件或目录

来自分类Dev

带有恶意软件“ / usr / bin / fuck”和“ /usr/bin/fake.cfg”的受损服务器

Related 相关文章

  1. 1

    gitlab ci无法使用shell执行器找到docker buildx命令

  2. 2

    Gitlab CI 中的 Docker 执行器将错误的 url 传递给 Git 存储库

  3. 3

    #!/usr/bin/python 行有什么作用?

  4. 4

    -bash:/ usr / bin / yum:/ usr / bin / python:错误的解释器:没有这样的文件或目录

  5. 5

    从/ usr / bin删除git

  6. 6

    Docker-compose:/ usr / local / bin / docker-compose:第1行:否:找不到命令

  7. 7

    Cronjob执行`/ usr / bin / python`而不执行`usr / bin / xrdb`

  8. 8

    从/ usr / bin / env或/ bin启动bash

  9. 9

    无法从usr / bin运行命令

  10. 10

    将现有命令的别名版本放在/ usr / bin /

  11. 11

    bash:/ usr / bin / ruby:没有这样的文件或目录

  12. 12

    键盘配置:/usr/local/bin/setupcon:900:/usr/local/bin/setupcon:/usr/local/bin/ckbcomp:未找到

  13. 13

    第1行:?#!/ usr / bin / sh:在尝试执行Shell脚本时找不到

  14. 14

    Ubuntu&PostgreSQL第24行:/usr/local/bin/psql.bin:没有这样的文件或目录

  15. 15

    Shell执行:时间与/ usr / bin / time

  16. 16

    为什么“ / usr / bin / env bash -x”仅在命令行中有效?

  17. 17

    / usr / bin / alternatives命令引发用法错误

  18. 18

    / usr / bin / alternatives命令引发用法错误

  19. 19

    /usr/bin/script 不回显任何命令

  20. 20

    /usr/bin/expect 内联多行命令

  21. 21

    在CentO上删除了/ usr / bin / docker

  22. 22

    bash: /usr/bin/ruby: No such file or directory

  23. 23

    包含与号的bash脚本的/ usr / bin / time

  24. 24

    bash:/ usr / bin / lein:权限被拒绝

  25. 25

    终端开始给错误bash:/ usr / bin / lesspipe

  26. 26

    BASH脚本在/ usr / bin中查找

  27. 27

    VS Code 找不到 /usr/bin/bash

  28. 28

    -bash:./conn.sh:/ usr / bin / bash:错误的解释器:没有这样的文件或目录

  29. 29

    带有恶意软件“ / usr / bin / fuck”和“ /usr/bin/fake.cfg”的受损服务器

热门标签

归档