Jenkins:在管道Jenkins文件中执行AWS CLI命令 [英] Jenkins: Execute AWS CLI command inside a pipeline Jenkins file

查看:475
本文介绍了Jenkins:在管道Jenkins文件中执行AWS CLI命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道如何在Jenkinsfile内部执行AWS CLI命令以构建管道吗?我没有找到任何插件

Do you know how to execute AWS CLI command inside a Jenkinsfile in order to build a pipeline? I didn't find any plugins

推荐答案

首先,您需要在服务器上安装aws cli,并确保jenkins用户具有运行它的权限.

First you need install aws cli on your server and make sure the jenkins user has permissions to run it.

或者在创建EC2实例时简单地使用Amazon AMI,它附带aws cli.

Or simply use the Amazon AMI when creating the EC2 instance, it comes with the aws cli.

使用适当的策略为实例分配角色. (在aws configure中使用用户密钥更简单)

Assign a role the instance with the appropriate policy. ( it is simpler that using user key in aws configure )

在您的管道步骤中,使用sh 'aws ...'

Within your pipeline steps use sh 'aws ...'

这篇关于Jenkins:在管道Jenkins文件中执行AWS CLI命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆