【问题标题】:AWS Codebuild: Command did not exit successfullyAWS Codebuild:命令未成功退出
【发布时间】:2021-12-19 07:13:30
【问题描述】:

我正在尝试使用 CodeBuild 在建筑物上安装 Python,但出现以下错误:

[Container] 2021/11/05 06:55:13 Successfully updated ssm agent configuration
[Container] 2021/11/05 06:55:13 Registering with agent
[Container] 2021/11/05 06:55:13 Phases found in YAML: 1
[Container] 2021/11/05 06:55:13  INSTALL: 3 commands
[Container] 2021/11/05 06:55:13 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2021/11/05 06:55:13 Phase context status code:  Message: 
[Container] 2021/11/05 06:55:13 Entering phase INSTALL
[Container] 2021/11/05 06:55:13 Running command apt-get install -y python38
/codebuild/output/tmp/script.sh: line 4: apt-get: command not found

[Container] 2021/11/05 06:55:13 Command did not exit successfully apt-get install -y python38 exit status 127
[Container] 2021/11/05 06:55:13 Phase complete: INSTALL State: FAILED
[Container] 2021/11/05 06:55:13 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: apt-get install -y python38. Reason: exit status 127

BuildSpec 包含以下内容:

version: 0.2

phases:
  install:
    commands:
       - apt-get install -y python38
       - python3 -m venv venv
       - source venv/bin/activate

我什至也试过yum

**更新 1 **

我进行了更改并运行了yum install python3,现在它给出了以下信息:

Dependencies Resolved

================================================================================
 Package                Arch        Version                Repository      Size
================================================================================
Installing:
 python3                aarch64     3.7.10-1.amzn2.0.1     amzn2-core      72 k
Installing for dependencies:
 libtirpc               aarch64     0.2.4-0.16.amzn2       amzn2-core      91 k
 python3-libs           aarch64     3.7.10-1.amzn2.0.1     amzn2-core     9.1 M
 python3-pip            noarch      20.2.2-1.amzn2.0.3     amzn2-core     2.0 M
 python3-setuptools     noarch      49.1.3-1.amzn2.0.2     amzn2-core     1.1 M

Transaction Summary
================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 12 M
Installed size: 57 M
Is this ok [y/d/N]: Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2021-11-05.07-26.BV6vZH.yumtx

[Container] 2021/11/05 07:26:53 Command did not exit successfully yum install python3 exit status 1
[Container] 2021/11/05 07:26:53 Phase complete: INSTALL State: FAILED
[Container] 2021/11/05 07:26:53 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: yum install python3. Reason: exit status 1

【问题讨论】:

    标签: amazon-web-services devops aws-codebuild


    【解决方案1】:

    如您所见,yum 命令需要一个操作来安装python3 - Is this ok [y/d/N]: Exiting on user command。但是你不回答它的问题,它就失败了。

    让我们接受安装python3 及其依赖项:

    yum install python3 -y
    

    【讨论】:

    • 谢谢。我正在尝试通过 Curl 安装 Rust,我也可以使用 -y 吗?
    猜你喜欢
    • 2019-12-04
    • 2017-04-25
    • 2017-10-29
    • 1970-01-01
    • 2021-09-04
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多