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.
Rated 4.0/5 based on 3 customer reviews

How To Configure Jenkins With BITBUCKET - Cloud Computing

744
  • by Rohan Singh
  • 03rd Oct, 2018
  • Last updated on 06th Mar, 2019
  • 3 mins read
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.

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

Join the Discussion

Your email address will not be published. Required fields are marked *

Suggested Blogs

Business Transformation through Enterprise Cloud Computing

The Cloud Best Practices Network is an industry solutions groups and best practices catalogue of how-to information for Cloud Computing. While we cover all aspects of the technology our primary goal is to explain the enabling relationship between this new IT trend and business transformation, where our materials include: Core Competencies – The mix of new skills and technologies required to successfully implement new Cloud-based IT applications. Reference Documents – The core articles that define what Cloud Computing is and what the best practices are for implementation, predominately referring to the NIST schedule of information. Case studies – Best practices derived from analysis of pioneer adopters, such as the State of Michigan and their ‘MiCloud‘ framework . Read this article ‘Make MiCloud Your Cloud‘ as an introduction to the Cloud & business transformation capability. e-Guides – These package up collections of best practice resources directed towards a particular topic or industry. For example our GovCloud.info site specializes in Cloud Computing for the public sector. White papers – Educational documents from vendors and other experts, such as the IT Value mapping paper from VMware. Core competencies The mix of new skills and technologies required to successfully implement new Cloud-based IT applications, and also the new capabilities that these platforms make possible: Virtualization Cloud Identity and Security – Cloud Privacy Cloud 2.0 Cloud Configuration Management Cloud Migration Management DevOps Cloud BCP ITaaS Procurement Cloud Identity and Security Cloud Identity and Security best practices (CloudIDSec) provides a comprehensive framework for ensuring the safe and compliant use of Cloud systems. This is achieved through combining a focus on the core references for Cloud Security, the Cloud Security Alliance, with those of Cloud Identity best practices: IDaaS – Identity Management 2.0 Federated Identity Ecosystems Cloud Privacy A common critcal focus area for Cloud computing is data privacy, particularly with regards to the international aspects of Cloud hosting. Cloud Privacy refers to the combination of technologies and legal frameworks to ensure privacy of personal information held in Cloud systems, and a ‘Cloud Privacy-by-Design’ process can then be used to identify the local legislated privacy requirements of information. Tools for designing these types of privacy controls have been developed by global privacy experts, such as Ann Cavoukian, the current Privacy Commissioner for Ontario, who provides tools to design and build these federated privacy systems. The Privacy by Design Cloud Computing Architecture (26-page PDF) document provides a base reference for how to combine traditional PIAs (Privacy Impact Assessments) with Cloud Computing. As this Privacy Framework presentation then explains these regulatory mechanisms that Kantara enables can then provide the foundations for securing the information in a manner that encompasses all the legacy, privacy and technical requirements needed to ensure it is suitable for e-Government scenarios. This then enables it to achieve compliance with the Cloud Privacy recommendations put forward by global privacy experts, such as Ann Cavoukian, the current Privacy Commissioner for Ontario, who stipulates a range of ‘Cloud Privacy By Design‘ best practices Cloud 2.0 Cloud is as much a business model as it is a technology, and this model is best described through the term ‘Cloud 2.0′. As the saying goes a picture tells a thousand words, and as described by this one Cloud 2.0 represents the intersection between social media, Cloud computing and Crowdsourcing. The Social Cloud In short it marries the emergent new online world of Twitter, Linkedin et al, and the technologies that are powering them, with the traditional, back-end world of mainframe systems, mini-computers and all other shapes and sizes of legacy data-centre. “Socializing” these applications means moving them ‘into the Cloud’, in the sense of connecting them into this social data world, as much as it does means virtualizing the application to run on new hardware. This a simple but really powerful mix, that can act as a catalyst for an exciting new level of business process capability. It can provide a platform for modernizing business processes in a significant and highly innovative manner, a breath of fresh air that many government agency programs are crying out for. Government agencies operate many older technology platforms for many of their services, making it difficult to amend them for new ways of working and in particular connecting them to the web for self-service options. Crowdsourcing Social media encourages better collaboration between users and information, and tools for open data and back-end legacy integrations can pull the transactional systems informtion needed to make this functional and valuable. Crowdsourcing is: a distributed problem-solving and production process that involves outsourcing tasks to a network of people, also known as the crowd. Although not a component of the technologies of Cloud Computing, Crowdsourcing is a fundamental concept inherent to the success of the Cloud 2.0 model. The commercial success of migration to Cloud Computing will be amplified when there is a strong focus on the new Web 2.0 type business models that the technology is ideal for enabling. Case study – Peer to Patent One such example is the Whitehouse project the Peer to the Patent portal, a headline example of Open Government, led by one its keynote experts Beth Noveck. This project illustrates the huge potential for business transformation that Cloud 2.0 offers. It’s not just about migrating data-center apps into a Cloud provider, connecting an existing IT system to a web interface or just publishing Open Data reporting data online, but rather utilizing the nature of the web to entirely re-invent the core process itself. It’s about moving the process into the Cloud. In this 40 page Harvard white paper Beth describes how the US Patent Office was building up a huge backlog of over one million patent applications due to a ‘closed’ approach where only staff from the USPTO could review, contribute and decide upon applications. To address this bottleneck she migrated the process to an online, Open version where contributors from across multiple organizations could help move an application through the process via open participation web site features. Peer to Patent is a headline example of the power of Open Government, because it demonstrates its about far more than simply publishing reporting information online in an open manner, so that they public can inspect data like procurement spending numbers. Rather it’s about changing the core decision-making processes entirely, reinventing how Government itself works from the inside out, reinventing it from a centralized hierarchical monolith to an agile, distributed peer to peer network. In essence it transforms the process from ‘closed’ to ‘open’, in terms of who and how others can participate, utilizing the best practice of ‘Open Innovation‘ to break the gridlock that had occured due the constraints caused by private, traditional ways of working. Open Grantmaking – Sharing Cloud Best Practices Beth has subsequently advised further on how these principles can be applied in general across Government. For example in this article on her own blog she describes ‘Open Grantmaking‘ – How the Peer To Patent crowdsourcing model might be applied to the workflows for government grant applications. She touches on what is the important factor about these new models, their ability to accelerate continual improvement within organizations through repeatedly sharing and refining best practices: “In practice, this means that if a community college wins a grant to create a videogame to teach how to install solar panels, everyone will have the benefit of that knowledge. They will be able to play the game for free. In addition, anyone can translate it into Spanish or Russian or use it as the basis to create a new game to teach how to do a home energy retrofit.” Beth describes how Open Grantmaking might be utilized to improve community investing in another blog, describing how OG would enable more transparency and related improvements. Cloud 2.0 As the underlying technology Cloud 2.0 caters for both the hosting of the software and also the social media 2.0 features that enable the cross-enterprise collaboration that Beth describes. Cloud Configuration Management CCM is the best practice for change and configuration management within Cloud environments, illustrated through vendors such as Evolven. Problem Statement One of the key goals and perceived benefits of Cloud computing is a simplified IT environment, a reduction of complexity through virtualizing applications into a single overall environment. However complexity actually increases.  Virtual Machines (VMs) encapsulate application and infrastructure configurations, they package up a combination of applications and their settings, obscuring this data from traditional configuration management tools. Furthermore the ease of self-service creation of VMs results in their widespread proliferation, and so actually the adoption of Cloud technologies creates a need for a new, extra dimension of systems management. This is called CCM, and incorporates: Release & Incident Management The increased complexity therefore increases the difficulties in trouble-shooting technical problems, and thus requires an updated set of tools and also updates to best practices like the use of ITIL procedures. ‘Release into Production’ is a particularly sensitive process within software teams, as major upgrades and patches are transitioned from test to live environments. Any number of configuration-related errors could cause the move to fail, and so CCM software delivers the core competency of being better able to respond quicker to identify and resolve these issues, reducing the MTTR significantly. DevOps DevOps is a set of principles, methods and practices for communication, collaboration and integration between software development and IT operations. Through the implementation of a shared Lean adoption program and QMS (Quality Management System) the two groups can better work together to minimize downtimes while improving the speed and quality of software development. It’s therefore directly linked to Business Agility. The higher the value of speed and quality = a faster ability to react to market changes, deploy new products and processes and in general adapt the organization, achieved through increasing the frequency of ‘Release Events’: It’s therefore directly linked to Business Agility. The higher the value of speed and quality = a faster ability to react to market changes, deploy new products and processes and in general adapt the organization, achieved through increasing the frequency of ‘Release Events’: ITaaS Procurement The fundamental shift that Cloud Computing represents is illustrated in one key implementation area: Procurement. Moving to Cloud services means changing from a financial model for technology where you buy your own hardware and software, and pay for it up front, to an approach where instead you access it as a rental, utility service where you “PAYG – Pay As You Go”. To encompass all the different ‘as a Service’ models this is known at an overall level as ‘ITaaS’ – IT as a Service. Any type of IT can be virtualized and delivered via this Service model.
Rated 4.0/5 based on 20 customer reviews
Business Transformation through Enterprise Cloud C...

The Cloud Best Practices Network is an industry ... 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

Monitoring AWS Machine using Azure Log Analytics - Cloud Computing

What is Azure Log Analytics?Logs make your life easier and help everyone in the organization understand what you do and what's Actually going on with the software. Ensure that you follow best practices of Azure Log Analytics for monitoring AWS machines effectively.Logs are created by network devices, applications, operating systems, and programmable or smart devices. They comprise several messages that are chronologically arranged and stored on a disk, in files, or in an application like a log collector.Firstly, we will try to understand why we need logs to monitor AWS services.We need logs because, with Azure Log Analytics, you can gather and search log data from all your resources, whether they reside on Azure, on another cloud host, or on-premises. Then you can transform the gathered data into rich analytics with AI-enhanced insights into your environment.  How Log Analytics worksThe log data from Virtual machines and other cloud resources, capture via some Agent which we need to install on VMs and Resource can be named as Connected Sources which further will be gathered in records and sent to OMS repository that is the part of Azure Cloud resource and stored in the Azure cloud.After receiving logs to log analytics it further is available for log search and other activity like Set Alerts, Dashboard View, Power BI View, and Export into Excel and Data files. Data collection in Azure Log AnalyticsData can be collected in azure Log Analytics in different ways –Agents on Windows and Linux virtual machines send telemetry from the guest operating system and applications to Log Analytics according to Data Sources that you configure.Connect a System Center Operations Manager management group to Log Analytics to collect data from its agents.Azure services such as Application Insights and Azure Security Center store their data directly in Log Analytics without any configuration.Write data from PowerShell command line or Azure Automation runbook using Log Analytics cmdlets.If you have custom requirements, then you can use the HTTP Data Collector API to write data to Log Analytics from any REST API client.Azure Monitor                   Data sources for events and performanceVirtual Machines               Data sources for events and performanceOperations Manager         Data from management group agentsApplication Insights           Application requests and exceptionsAzure Security Center       Security eventsPowerShell                        PowerShell command line or runbookData Collector API            Rest API for custom dataIncoming data automatically indexed. Data types and tables automatically created.Log AnalyticsData available through log search and smart analytics to multiple channels.Design and test queries and analyze data         AnalyticsVisualize data in Azure portal                            DashboardsWorkflows consuming Log Analytics data         Logic AppsAutomatically respond critical conditions           AlertsExport for visualization with other sources        Power BIPowerShell command line or runbook               PowerShellRest API for custom application                         Log Search APIWork flow of Log AnalyticsNow let's find out the workflow of log analytics like how it collects data, analyze, visualize and alerts.So first look into Collect part–The logs can be collected via: -Event LogsCustom App LogsIIS LogsCrash DumpsPerformance DataWe can also filter the type of logs by just checking and unchecking the log types.Once the collection has done we need to Analyse the data which can be done by: -Filter based on attributesAnalyze data with Kusto Query languageSort dataExport log data to Excel and Power BIConditional FilteringAfter that, we can Visualize all the logs in an attractive DashboardAlerts can be configured on the basis of event conditions like once the value will be reached greater than or less than the limit threshold it will automatically generate the alerts and take configured actions like sending main, sending a message and start runbook (part of azure automation).Steps to collect Data and log from AWS MachinesAWS VMs could be of Windows and Linux, so we can install the agent which can be download from azure log analytics page by just selecting the type of the OS and the Bit of the VMs.After installing the Agent we need to configure the agent by entering the workspace id and key which will be provided by the azure after configuring. We can get the all the logs within some Hours in the portal.Supported AWS OS and VersionsLet’s discuss the OS and versions of VMs that are supported on AWS Cloud.If you are using Windows, the configuration should be:Windows Server 2008 Service Pack 1 (SP1) or laterWindows 7 SP1 and laterIf you are using Linux, the configuration should be:Amazon Linux 2012.09 to 2015.09 (x86/x64)CentOS Linux 5, 6, and 7 (x86/x64)Oracle Linux 5, 6, and 7 (x86/x64)Red Hat Enterprise Linux Server 5, 6 and 7 (x86/x64)Debian GNU/Linux 6, 7, and 8 (x86/x64)Ubuntu 12.04 LTS, 14.04 LTS, 16.04 LTS (x86/x64)SUSE Linux Enterprise Server 11 and 12 (x86/x64)After verifying the supported configuration, we can successfully install the agent and receive the logs.Kusto to query AWS Machine LogsKusto is a log analytics cloud platform optimized for ad-hoc big data queries.Kusto Query Reference Portal: https://docs.loganalytics.ioThe Kusto Query Language is used to query Azure services.OMS (Operational Management Suite)The Microsoft Operations Management Suite (OMS), previously known as Azure Operational Insights, is a software as a service platform that allows an administrator to manage on-premises and cloud IT assets from one console.Azure OMS provides 4 types of services: -Log Analytics: Monitor and analyze the availability and performance of different resources including physical and virtual machines.Automation: Automate manual processes and enforce configurations for physical and virtual machines.Backup: Backup and restore critical data.Site Recovery: Provide high availability for critical applications.Management SolutionsManagement solutions leverage services in Azure provides additional insight into the operation of a particular application or service.Here, we can manually select the required solution and add to the home page where we can only see the logs of that solution type.ReportsThe final reports of logs can be exported in Excel and Power BI that can be displayed in table and chart format.Conclusion:Azure Log Analytics is a very powerful tool to capture different types of system log. Kusto Query plays a very important role in extracting insights from the log file. Also, custom reports can be prepared using KUSTO Query,which helps the organization in saving many man-hours.Detailed reports and easy to export to excel and power helps to keep the troubleshooting and diagnosis handy.Reports can be embedded in any website with live refresh data and code snipped can be generated within power BI.Choose the right Azure logging service for AWS monitoring and use it to save many man-hours and reduce the time of troubleshooting and diagnosis.
Rated 4.0/5 based on 2 customer reviews
1029
Monitoring AWS Machine using Azure Log Analytics -...

What is Azure Log Analytics?Logs make your life ea... Read More

Useful links