Home > OS >  AWS Codebuild: Command did not exit successfully
AWS Codebuild: Command did not exit successfully

Time:11-05

I am trying to use CodeBuild to install Python on the building I am getting the following error:

[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 contains the following:

version: 0.2

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

I even tried yum too.

**Update 1 **

I made the changes and ran yum install python3 and now it gives the following:

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

CodePudding user response:

As you can see, the yum command requires an action to install python3 - Is this ok [y/d/N]: Exiting on user command. But you don't respond to its question, then it failed.

Let's accept to install python3 and its dependencies:

yum install python3 -y
  • Related