Showing posts with label bitbucket. Show all posts
Showing posts with label bitbucket. Show all posts

Thursday, 17 December 2020

How to Create a Bitbucket Pull Request


Using a pull request, you're requesting that another developer or the project owner pull a branch from your repository and add it to the project. Here's how to create a pull request from the Bitbucket website.

How to Create a Bitbucket Pull Request

To create a pull request, you'll have to make sure that your branch is updated with new code that you want to be reviewed. Before going any further, check and save your work on the local machine and update the branch.

Then, open the Bitbucket website on your browser and navigate to the repository in question.




Click on the menu button in the top-left, and select Pull Requests.



Here, click on the Create pull request button.


The pull request creation form will open.


There are a few things to do on this form:

  • From the left dropdown menu, select the sub-branch (source repository) that you want to merge into the master branch.

  • On the right, make sure that the project and the master branch (destination repository) are selected.

  • You can create a separate title for the pull request and write a short description of the code that you've written or the task that you've completed.

  • At the bottom, you'll indicate the Reviewers. This is the most important step: Type in the name of one or more developers who need to review your code.

  • If you automatically want to close the branch once the pull request is merged, click the Close branch checkbox.

Before submitting the request, you can scroll below the form to take a look at the code differences between the test branch and the master branch and go over the recent commits.

Once you're confident about it, click Create pull request.




The process from your side is now complete. The reviewers will get an email notification about your pull request. They'll be able to view all the contents of your branch, compare it with the master branch, and leave comments.

Once they're satisfied with your work, they can click Merge to merge your branch's code with the master branch.







Friday, 18 September 2020

End to End Automation of Java web App Using jenkins, bitbucket,sonaqube,Maven,Tomcat,Artifactory,Slack

 Tools Used:

  • Bitbucket— Source Code Management
  • Maven — Build Tool
  • Jenkins — Continuous Integration (CI/CD)
  • Artifactory — Artifact Repository Manager
  • SonarQube — Code Quality and Code Analysis
  • Tomcat — Application Server(Web container)



What is the Requirement? - Setup MyDevopsApp Java Project using Maven in Bitbucket and Automate end to end Builds, Code quality checks, Deployments and Collaboration using Jenkins and other Devops tools we have used so far. Could you please work on below lab exercise on a brand new EC2 instance(small instance) and show the output when we meet on next week end?


Lab Exercise Steps:
1. Also, create a repo called MyAutomationRepo in bitbucket. (lab exercise # 5)
2. Create a Java project called MyDevopsApp (instead of MyWebApp which we did before (lab exercise #5) using Maven.
3. Set the above project in Bitbucket(lab exercise #5)
4. Set up a free style job called MyDevopsFreeStyleJob (use webhooks,lab exercise #6, lab exercise # 8) in Jenkins and automate builds, deployments to Tomcat server (lab exercise #6). Also integrate with SonarQube to see the code quality report(lab exercise #10). Finally Jenkins should deploy to Tomcat immediately if there is a code change(lab exercise #7, lab exercise 8). Also jenkins should upload WAR into Artifactory as well. (lab exercise # 17, lab exercise 18). And send notifications to Slack(lab exercise # 19)
5 Finally show the below output in Tomcat by modifying index.jsp (lab exercise #6) in your java project. 
       Congrats I am now a Devops Engineer I Can Migrate App to cloud using Bitbucket,Jenkins,Maven and Tomcat!!!
6. SonarQube dashboard should be viewed in Sonarqube.
7. Artifactory should show uploaded artifacts as well.
8. Slack should show the message coming from Jenkins for every build success/failure.

Tips:

You all know the maven command to create a Java project using Maven and where you to change the word MyWebApp to MyDevopsApp.
mvn archetype:generate -DgroupId=com.mkyong -DartifactId=MyWebApp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

Tuesday, 1 September 2020

How to configure webhooks in Bitbucket to trigger a build in Jenkins? How to trigger automated builds in Jenkins through Bitbucket

 

Jenkins jobs can be triggered many ways. Here are those ways:


1. pull - using poll scm
2. Webhooks (push mechanism) - by triggering a build from Bitbucket or GitHub for every repository changes.
3. through slack channel. We will cover this in a later class.
 

Webhooks are triggers that enables developers to trigger Jenkins jobs automatically every time there is a code change

we will see in this article how to trigger a(push) build for every change in bitbucket repository:

Changes needed in Jenkins


1. Install the Bitbucket Plugin:

Go tom Manage Jenkins---Plugin Manager

Search Bitbucket and install without restart


Select the job you would like to configure webhook is for. 

Choose configure 

Click on the build job. 

Go to triggers section and click on Build When a change is Pushed to Bitbucket


Also uncheck poll SCM option(if it was selected earlier)



Changes in Bitbucket

1. go to bitbucket, choose the repository, go to settings, click on web hooks.



2. enter title, url which is your jenkins job url - append b
 example the url should be like this - http://jenkins_public_dns_server_url:8080/bitbucket-hook/

Sample url is given below:

http://jenkins_url:8080/bitbucket-hook/

3. status should be active
4. click on skip certificate verification
5. triggers --> repository push

Now make a code change in bitbucket to see if that triggers a build in Jenkins automatically.


How to upgrade Maven

  java.lang.IllegalStateException I had installed maven in my ubuntu using command  apt install maven This installed maven in path /usr/shar...