我正在尝试将Jenkins与AWS CodeCommit集成。Jenkins在具有Ubuntu 14.04的AWS EC2实例上运行。
我关注了此博客文章:http : //blogs.aws.amazon.com/application- management/post/Tx1C8B98XN0AF2E/Integrating-AWS-CodeCommit-with- Jenkins
问题是,由于jenkins用户没有权限,因此不会执行 sudo -u jenkins aws configure 。
你会怎么做?
以下命令无法正常运行:
sudo -u jenkins git config --global credential.helper '!aws codecommit credential-helper $@' sudo -u jenkins git config --global credential.useHttpPath true sudo -u jenkins git config --global user.email "me@mycompany.com" sudo -u jenkins git config --global user.name "MyJenkinsServer"
jenkins用户需要什么权限?
提前致谢。
我能够使用SSH实现此集成。在某种程度上,我遵循了以下说明: 设置CodeCommit
假设Jenkins Home是/ var / lib / jenkins /
在Jenkins EC2实例(/var/lib/jenkins/.ssh/id_rsa)上创建一个ssh密钥
ssh-keygen -b 2048 -t rsa -f /var/lib/jenkins/.ssh/id-rsa -a -N
将公钥上载到IAM用户(IAM用户必须具有CodeCommit访问权限)
aws iam upload-ssh-public-key --user-name <username> --ssh-public-key-body file:///var/lib/jenkins/.ssh/id_rsa.pub
上载密钥时收集SSHPublicKeyID
{ "SSHPublicKey": { "UserName": "jenkins", "Status": "Active", "SSHPublicKeyBody": "ssh-rsa <rsa-key> <host>\n", "UploadDate": "2015-09-02T19:18:24.309Z", "Fingerprint": "xxx", "SSHPublicKeyId": "APK***" } }
Host git-codecommit.*.amazonaws.com User APK******* IdentityFile /var/lib/jenkins/.ssh/id_rsa StrictHostKeyChecking no
其中APK ***是在步骤3中检索到的密钥ID的值
将此文件复制或移动到/var/lib/jenkins/.ssh/config(或EC2实例上安装了Jenkins的任何位置)