ubuntu 无法在AWS CodeBuild项目中使用curl:未找到退出状态127命令

bvjxkvbb  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(111)

它发生在post_build阶段。

  • 尝试先安装,但已安装。
  • 尝试将PATH导出为包含/usr/bin(安装curl的位置)
[Container] 2023/11/28 16:44:10.462047 Running command ls -la $(which curl)
-rwxr-xr-x 1 root root 260328 Oct  3 17:15 /usr/bin/curl

[Container] 2023/11/28 16:44:10.517469 Running command echo $PATH
/usr/local/bin/sbt/bin:/root/.goenv/shims:/root/.goenv/bin:/go/bin:/root/.phpenv/shims:/root/.phpenv/bin:/root/.pyenv/shims:/root/.pyenv/bin:/root/.rbenv/shims:/usr/local/rbenv/bin:/usr/local/rbenv/shims:/root/.dotnet/:/root/.dotnet/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tools:/codebuild/user/bin

Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command:(...) Reason: exit status 127

字符串

bttbmeg0

bttbmeg01#

问题是我执行命令的方式:

echo "$DATA" | gzip -c | curl -X POST -H "$AK" -H "$CT" "$URL" --data-binary @-

字符串
(在shell中工作- bash)
解决办法是:

- temp=$(mktemp)
    - $(echo "$DATA" | gzip -c > "$temp")
    - 'curl -X POST -H "Api-Key: $LK" -H "Content-Encoding: gzip" "$URL" --data-binary "@$temp"'
    - rm -rf "$temp"

相关问题