在我的bitbucket-pipelines.yml
文件中,我有这个:
- step:
image: python:3.7.2-stretch
name: upload to s3
script:
- export S3_BUCKET="elasticbeanstalk-us-east-1-133233433288"
- export VERSION_LABEL=$(cat VERSION_LABEL)
- sudo apt-get install -y zip # required for packaging up the application
- pip install boto3==1.3.0 # required for upload_to_s3.py
- zip --exclude=*.git* -r /tmp/artifact.zip . # package up the application for deployment
- python upload_to_s3.py # run the deployment script
但是当我在Bitbucket中运行此管道时,我收到一个错误,输出结果如下:
+ sudo apt-get install -y zip
bash: sudo: command not found
为什么不知道sudo
是什么意思?所有Linux机器都不常见吗?
当在env $ PATH中配置的文件夹中找不到二进制文件时,在stderr中打印“command not found”错误
首先你需要找出它是否存在:
find /usr/bin -name "sudo"
如果你发现二进制文件尝试设置PATH变量:
export PATH=$PATH:/usr/bin/
然后尝试再次运行sudo。
不,sudo
无处不在。
但无论如何,你不必费心。运行图像时,你是root
,所以你可以简单地运行apt-get
而无需考虑权限。