无人机构建错误:无法找到包git

时间:2016-10-24 16:36:58

标签: drone drone.io

我的drone.yml文件如下.. 继续收到错误unable to locate package git. 有什么建议吗?

 pipeline:
        build:  
            image: python:3.5.1-slim
            commands:
                - apt update && apt install git-core
                - pip install -r requirements.txt
                - nosetests --with-coverage --cover-erase --cover-package 

1 个答案:

答案 0 :(得分:1)

你提供了完整的yaml吗?因为示例yaml失败并显示Do you want to continue? [Y/n] Abort错误消息,因为无人机在非交互模式下运行并且无法阻止并等待用户提示继续。它不会因问题中指定的错误消息而失败。

因此,您需要使用-y运行命令,如下所示:

pipeline:
  build:  
    image: python:3.5.1-slim
    commands:
      - apt-get update
      - apt-get install -y git-core
      - which git

这会在我的日志中产生以下输出:

+ which git
/usr/bin/git

请注意,当无人机运行您的构建时,它会将命令转换为简单的shell脚本,启动容器,并将shell脚本作为入口点执行。所以你的yaml会变成这样的东西:

#!/bin/sh
set -e

apt-get update
apt-get install -y git-core
which get

这意味着您应该能够直接从Docker的命令行测试命令,以查明看起来像是图像或命令问题:

$ docker run -t -i python:3.5.1-slim
# apt-get update && apt-get -y install git-core
# which git

对不起,我没有完全回答这个问题,但是我无法用问题中提供的示例yaml重复相同的错误消息。如果您可以在问题中提供更多说明,我可以回到这个答案并编辑回复