integrate Jenkins with AWS CodeCommit

0 votes

I'm trying to integrate Jenkins with AWS CodeCommit. My jenkins is running on an ec2 instance with ubuntu 14.04. 

The problem is, that sudo -u jenkins aws configure isn't executed because the jenkins user has no permissions.

What would you do?

Apr 15 in Jenkins by Vishal
282 views

2 answers to this question.

+1 vote

Hey @Vishal, Follow these steps:

  1. Create an ssh key on the Jenkins EC2 instance (/var/lib/jenkins/.ssh/id_rsa)

    ssh-keygen -b 2048 -t rsa -f /var/lib/jenkins/.ssh/id-rsa -a -N
    
  2. Upload the public key to an IAM user (IAM user must have CodeCommit access)

    aws iam upload-ssh-public-key --user-name <username> --ssh-public-key-body file:///var/lib/jenkins/.ssh/id_rsa.pub
    
  3. Collect the SSHPublicKeyID when you upload the key

    {
     "SSHPublicKey": {
     "UserName": "jenkins",
     "Status": "Active",
     "SSHPublicKeyBody": "ssh-rsa <rsa-key> <host>\n",
     "UploadDate": "2015-09-02T19:18:24.309Z",
     "Fingerprint": "xxx",
     "SSHPublicKeyId": "******"
     }
    }
    
  4. Create/modify SSH config file

    Host git-codecommit.*.amazonaws.com
      User APK*******
      IdentityFile /var/lib/jenkins/.ssh/id_rsa
      StrictHostKeyChecking no
    
  5. Where the ****** is the value of the Key ID retrieved in step 3

  6. Copy or move this file to /var/lib/jenkins/.ssh/config (or wherever Jenkins is installed on your EC2 instance)
  7. Ensure jenkins' user has 0600 permissions to /var/lib/jenkins/.ssh directory
  8. Create a Jenkins job as described in the blog post you first used. For the repository URL, however, enter the SSH url instead.
answered Apr 15 by Pooja
+1 vote
jenkins user add in visudo or /etc/sudoers
answered May 14 by anonymous
Is that all?
Yea this answer makes sense...Giving root priviliges to the user...

Related Questions In Jenkins

0 votes
0 answers

integrate Jenkins with AWS CodeCommit

I'm trying to integrate Jenkins with AWS ...READ MORE

Apr 15 in Jenkins by Vishal

closed May 14 by Vardhan 50 views
0 votes
1 answer

any way to integrate Jenkins with ServiceNow?

Now, there is no official servicenow support ...READ MORE

answered Apr 10, 2018 in Jenkins by DareDev
• 6,810 points
922 views
0 votes
1 answer

Unable to integrate jenkins with tfs: EndpointNotFoundException

Check if you can connect to tfs ...READ MORE

answered May 28, 2018 in Jenkins by DareDev
• 6,810 points

edited May 28, 2018 by DareDev 112 views
0 votes
1 answer

How could I integrate Selenium with Jenkins?

Hey @Ali, follow these steps to integrate ...READ MORE

answered Dec 20, 2018 in Jenkins by Eric
98 views
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,160 points
101 views
+13 votes
2 answers
0 votes
1 answer

Use a docker image with jenkins declarative pipeline

Hey @Jithin, you could use something like ...READ MORE

answered Apr 12 in Jenkins by Bishu
349 views
0 votes
1 answer

Use Custom Docker registry with jenkins declarative pipeline

Yes, you can! try something like this: node ...READ MORE

answered Apr 12 in Jenkins by Bishu
107 views