我是 Jenkins 的新手,已经开始学习它了。
实际上我一直在尝试在 shell 脚本中使用 AWS 命令并使用 Jenkins 运行它。但它说 - aws 命令未找到。
我已经安装了所有必需的插件并重新启动了詹金斯。但还是一样。
所有启用的插件:
Amazon Web Services SDK :: All
Version1.12.287-357.vf82d85a_6eefd
This plugin provides all AWS SDK for Java modules not packaged as standalone plugins.
Report an issue with this plugin
Amazon Web Services SDK :: CloudFormation
Version1.12.287-357.vf82d85a_6eefd
CloudFormation module for the AWS SDK for Java.
Amazon Web Services SDK :: CodeBuild
Version1.12.287-357.vf82d85a_6eefd
CodeBuild module for the AWS SDK for Java.
Amazon Web Services SDK :: EC2
Version1.12.287-357.vf82d85a_6eefd
EC2 module for the AWS SDK for Java.
Amazon Web Services SDK :: ECR
Version1.12.287-357.vf82d85a_6eefd
ECR module for the AWS SDK for Java.
Amazon Web Services SDK :: ECS
Version1.12.287-357.vf82d85a_6eefd
ECS module for the AWS SDK for Java.
Amazon Web Services SDK :: EFS
Version1.12.287-357.vf82d85a_6eefd
EFS module for the AWS SDK for Java.
Amazon Web Services SDK :: Elastic Beanstalk
Version1.12.287-357.vf82d85a_6eefd
Elastic Beanstalk module for the AWS SDK for Java.
Amazon Web Services SDK :: IAM
Version1.12.287-357.vf82d85a_6eefd
EC2 module for the AWS SDK for Java.
Amazon Web Services SDK :: Logs
Version1.12.287-357.vf82d85a_6eefd
Logs module for the AWS SDK for Java.
Amazon Web Services SDK :: Minimal
Version1.12.287-357.vf82d85a_6eefd
Minimal modules for the AWS SDK for Java.
Amazon Web Services SDK :: SNS
Version1.12.287-357.vf82d85a_6eefd
SNS module for the AWS SDK for Java.
Amazon Web Services SDK :: SQS
Version1.12.287-357.vf82d85a_6eefd
SQS module for the AWS SDK for Java.
Amazon Web Services SDK :: SSM
Version1.12.287-357.vf82d85a_6eefd
SSM module for the AWS SDK for Java.
我只是尝试运行 - aws help 命令并收到以下错误
+ aws help
/tmp/jenkins1806878893080825405.sh: 2: aws: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
任何有关如何解决此问题的线索将不胜感激。
这对我有用:
stage ('Install dependencies'){
steps{
script{ sh '''
apt-get update
apt-get install -y docker.io unzip curl
rm -rf awscliv2.zip aws/
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -o awscliv2.zip
./aws/install
docker --version
aws --version
'''
}
}
}