Search

How To Configure Jenkins With BITBUCKET - Cloud Computing

PURPOSE:This article will provide you a complete detailed knowledge of configuring Jenkins with Bitbucket repository which will help in automating the deployment process and will help to set the path for the interaction of Jenkins continuous integration tool with bitbucket repository.INTRODUCTION:As a part of the continuous integration and deployment process, it is a requirement that the code repository should have an interaction with the build automation and continuous integration tool. In this article, we are working with bitbucket and Jenkins to achieve the same, but this could be similar to the other tools that are available in the market. Let’s see the steps to integrate a Bitbucket with the Jenkins.Ways for Enabling Jenkins with Bitbucket:STEP 1: Login to your Jenkins and then select Manage Jenkins->Plugin Manager and on the tab available select the option bitbucket plugin and click on install without restart. In my case, this is installed already hence it’s showing under the Installed section.Step 2: Once the installation is done, configure a sample project and in build triggers section during the creation of a new project select build when a change is pushed to bitbucket and click apply and save to enable trigger Jenkins with bitbucket:Step 3: Now, visit Bitbucket URL: https://bitbucket.org/ and create your own repository, if you haven’t created yet else visit your own bitbucket repository for the purpose of this course. I have LearnShareKnowledge as the repository-Step 4: Click on the clone and copy the repository URL which you want to configure with Jenkins from bitbucket:Step 5: Go back to Jenkins and click on the project which you have to create and click on configure under the Source Code Management section, select the repository type which you have in your bitbucket repository. In my case, it is git and paste the URL by removing git clone to connect Jenkins with bitbucket. Click on save to reflect the changes:Step 6: Select the credentials if it is not a public repository for configuring the credentials, you can click the Add button on credentials section and proceed with username and password under global credentials domain and click Add.Step 7: Now, again visit the bitbucket repository which you want to configure. For that, click on settings under that repository:Step 8: Under settings, click on webhooks highlighted in the picture:Step 9: Click on add webhook and give the title to that webhook and paste the URL of Jenkins which you have configured with bitbucket and then select active and repository push and save the changes. If you want to make this more secure, then you can verify this with SSL certificate but in my case,  I used a secure key which provides a security to this setup:Now with the Jenkins setup for Bitbucket, we are ready to test the complete configuration. As soon as you do commit to the repository, you will be having an automated build triggered initiating a job inside the Jenkins project which you have configured with the repository.
How To Configure Jenkins With BITBUCKET - Cloud Computing
Rohan
Rated 4.0/5 based on 3 customer reviews
Rohan

Rohan Singh

Blog Author

Rohan Singh is the Devops Engineer Manager and Solution Architect at healthcare product based MNC, he is a technical blogger who shares technical related issues based on real life experiences to motivate IT professionals in putting their efforts for the betterment of  Devops and solution architect field

Posts by Rohan Singh

How To Configure Jenkins With BITBUCKET - Cloud Computing

PURPOSE:This article will provide you a complete detailed knowledge of configuring Jenkins with Bitbucket repository which will help in automating the deployment process and will help to set the path for the interaction of Jenkins continuous integration tool with bitbucket repository.INTRODUCTION:As a part of the continuous integration and deployment process, it is a requirement that the code repository should have an interaction with the build automation and continuous integration tool. In this article, we are working with bitbucket and Jenkins to achieve the same, but this could be similar to the other tools that are available in the market. Let’s see the steps to integrate a Bitbucket with the Jenkins.Ways for Enabling Jenkins with Bitbucket:STEP 1: Login to your Jenkins and then select Manage Jenkins->Plugin Manager and on the tab available select the option bitbucket plugin and click on install without restart. In my case, this is installed already hence it’s showing under the Installed section.Step 2: Once the installation is done, configure a sample project and in build triggers section during the creation of a new project select build when a change is pushed to bitbucket and click apply and save to enable trigger Jenkins with bitbucket:Step 3: Now, visit Bitbucket URL: https://bitbucket.org/ and create your own repository, if you haven’t created yet else visit your own bitbucket repository for the purpose of this course. I have LearnShareKnowledge as the repository-Step 4: Click on the clone and copy the repository URL which you want to configure with Jenkins from bitbucket:Step 5: Go back to Jenkins and click on the project which you have to create and click on configure under the Source Code Management section, select the repository type which you have in your bitbucket repository. In my case, it is git and paste the URL by removing git clone to connect Jenkins with bitbucket. Click on save to reflect the changes:Step 6: Select the credentials if it is not a public repository for configuring the credentials, you can click the Add button on credentials section and proceed with username and password under global credentials domain and click Add.Step 7: Now, again visit the bitbucket repository which you want to configure. For that, click on settings under that repository:Step 8: Under settings, click on webhooks highlighted in the picture:Step 9: Click on add webhook and give the title to that webhook and paste the URL of Jenkins which you have configured with bitbucket and then select active and repository push and save the changes. If you want to make this more secure, then you can verify this with SSL certificate but in my case,  I used a secure key which provides a security to this setup:Now with the Jenkins setup for Bitbucket, we are ready to test the complete configuration. As soon as you do commit to the repository, you will be having an automated build triggered initiating a job inside the Jenkins project which you have configured with the repository.
Rated 4.0/5 based on 3 customer reviews
How To Configure Jenkins With BITBUCKET - Cloud Co...

PURPOSE:This article will provide you a complete d... Read More

SSHing into Ubuntu EC2 instance post blocking port 22 with UFW - Cloud Computing

IntroductionThis blog is in reference to a troubleshooting situation in Amazon Web Services when you have configured firewall setting in your ubuntu ec2 or remote instance and is not able to login via PuTTY through SSH as the instance. Here, we will see how to insert SSH into the instance in a certain situation when you are logged out of that instance.During configuration of SSL security, we may accidentally or purposely block SSH for the instance to make the instance secure. But, what if we again want the same instance to SSH for certain changes.  Below is the highlighted configuration of the instance. Here, you can see that all the instances have all ports opened to everything.Here are the configuration changes which you have made on the login into instance:$ sudo apt-get update $ sudo apt-get install nginx $ sudo apt-get install ufw  Check UFW Status and Rules At any time, you can check the status of UFW with this command:$ sudo ufw status verbose By default, UFW will be disabled so you should see something like this:Output: Status: inactive If UFW is active, the output will say that it's active, and it will list the rules that are set. For example, if the firewall is set to allow SSH (port 22) connections from anywhere, the output might look something like this:Output: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To                         Action      From --                         ------      ---- 22/tcp                     ALLOW IN Anywhere $ sudo ufw deny ssh $ sudo ufw status verbose Output: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To                         Action      From --                         ------      ---- 22/tcp                     DENY    Anywhere If you kicked or logged out of the instance once the changes are done, you will be seeing the below results.On SSH into the instance with your Public DNS through PuTTY below are the results which you are seeing as an error i.e. Network error: Connection Timed Out  Below error shows that even after all ports were opened outside, the instance is not able to SSH because of firewall software of Ubuntu at the system level. Let’s see how to resolve this kind of system related issue.Solution to the issue:Step 1: Take an image of the EC2 instance by selecting the instance ->Image-Create ImageStep 2: Provide specification Image name, tick on no reboot and push the create image buttonStep 3: Then Select the image and click on launchStep 4: Go to instance type, select and click on NextStep 5: In the configuration instance, write the below commands under Advanced Details and click on next:#!/bin/bash sudo ufw allow ssh sudo ufw allow 22 sudo ufw allow 443 sudo ufw allow 8080 sudo ufw allow 80 sudo ufw status  sudo ufw enable Step 6: Click next and next tab and add security group similar as providedStep 7: Review and launch the instance and then try to SSH to the instance through PuTTY. You will be now able to add SSH inside the instance with this and you can terminate the old instance as the new instance with all the setup same as that of the old instance without any issue except the public IP and private IP change.Best Practices of Firewall Configuration & Port Blocking:Ensure that the Security Groups will allow a specific IP addresses which are within the VPN Range of the Environment.Use of NACL for allowing and blocking the IP addresses or subnets for a specific Port by using allow and deny rules. A network ACL contains a numbered list of rules that we evaluate in order, starting with the lowest numbered rule. This helps to determine whether traffic is allowed in or out of any subnet associated with the network ACL. The highest number that you can use for a rule is 32766. We recommend that you start by creating rules in increments (for example, increments of 10 or 100) so that you can insert new rules.Use of Bastion Host for accessing critical servers and environment is always a better option to increase the security of the system or environment. 
Rated 4.0/5 based on 3 customer reviews
SSHing into Ubuntu EC2 instance post blocking port...

IntroductionThis blog is in reference to a trouble... Read More