Thursday, 26 January 2017

What is the difference between git stash and git commit?

git stash -- The command saves your local modifications away and reverts the working directory to match the HEAD commit. It allows you to store your uncommited modifications into a buffer area called stash, and deletes it from the branch you are working on. You may later retreive them by applying the stash.

git commit -- This records your change for next push and this event is recorded in history too.

What is the difference between rebase and merge in Git?

By merging you create a new commit with the result of the fusion of the target branch and source branch.

With rebase you put the commit of the current branch on top of the source branch.


Usage rules:
* use rebase on your own branch before asking for a merge in order to have a clean history
* use merge when you work with other people on the same branch


In case of doubt use merge it's safer.

What is the difference between the reset and revert commands in the Git version control system?

Git revert command is used to revert a particular commit.
Most of the times a commit is reverted when it is causing the regression during testing.

When git revert is done this itself results in a commit(author as a person who is reverting). 

Usage is as follows:
git revert [options] <commit-ish>
or: git revert <subcommand>
    --quit                end revert or cherry-pick sequence
    --continue            resume revert or cherry-pick sequence
    --abort               cancel revert or cherry-pick sequence
     -n, --no-commit       don't automatically commit
    -e, --edit            edit the commit message
    -s, --signoff         add Signed-off-by:
    -m, --mainline <n>    parent number
    --rerere-autoupdate   update the index with reused conflict resolution if           possible
    --strategy <strategy>      merge strategy
    -X, --strategy-option <option> option for merge strategy

In simple terms to revert a particular commit git revert <commit-id>.
This internally creates a separate commit for reverting a previous commit.

Gir reset on the other hand is primarily used to  reset the current HEAD to the specified state.

git reset is also very helpful in the following scenarios

1. When you have made some changes and you no longer wanted them to be committed you just wanted to go back to the older clean state
git reset --hard HEAD
2. When you wanted to go to two commits back
git reset --hard HEAD~2
3. When you are doing git pull. It might result in merging errors. In this case you might just want to get rid of the mess, then you can simply use 
git reset --hard HEAD
4. You might have added a file to commit using  git add abc.c
but later you realized you do not want to add then you can use the following
git reset -- abc.c

What is the use of git cherry-pick command?

cherry-pick command will be useful, when you want to pick specific commit from one branch and apply it on another branch.


Let's say two developers working on a feature, each developer working on separate task relate to the feature on two different branches and commit it once the task has been done. At the end of the day, they need to merge both the task together and merge it with master branch. In this case, we pick one of the developer commit by copy it's commit ID got from git log command and navigate it to another developer branch and using the following command git cherry-pick <copied-commit-id>apply the changes in the commit to the current developer branch.

How to Run LoadRunner in Jenkins Continuous Integration

To start using the HP Application Automation tools with LoadRunner you need to do the following setup work in Jenkins:
 
First install the Jenkins HP Application Automation tools add-in
1) In your Jenkins instance, navigate to the Manage Jenkins area and click on the Manage Plugins link.
2) Click on the Available Tab.
3) Under the Filter textbox, enter HP.
4) Under the Available tab, look for the name HP Application Automation Tools.
5) Click on the Install checkbox and click on the Download Now and Install After
Restart button.
Configure Jenkins
Once the add-in is installed and you have restarted Jenkins:
  1. Click on the Jenkins>New Job menu option. 
  2. Enter a Job Name – I named my RunLoadrunner – and click on the Build a free-style software project option. Click OK
  3. Under the your new project’s configuration scroll down to the Build section and click on the Add build step and click on the Execute HP tests from file system option
  4. Under Build you should now have an option for LoadRunner-Specific Settings.. – Click on it.
  5. Under the LoadRunner Settings enter the following:
  • Controller Polling Interval – the time to poll the LR Controller for your scenario status
  • Scenario Execution Timeout – this is the total time for the execution of all your scenarios
  • Errors to Ignore – – during the run you can tell which errors to ignore
  1. Under the Build/TestsSECTION enter the path to your LoadRunner scenario. For example my scenario named JnekinsDebug.lrs lives under my D:\myLoadRuner directory. So my Tests field = D:\myLoadRunner
  2. Under the Post-build Actions section click on the Add post-build action and select Publish HP tests result
  3. Apply and Save your settings
  4. Run the LR job you just created like you would any standard Jenkins job
Set LoadRunner Scenario SLA
One thing toWATCH out for is to make sure that your scenario has a SLA defined. If it does not your Jenkins job will fail with a message similar to this:
To fix just go into your Scenario in the LoadRunner Controller and add a SLA:
LR Jenkins CI Wrap-up
That is how you integrate LoadRunner with Jenkins. Hope it helps. Let me know if I missed anything.

How to trigger builds on SVN commit

What plugins and plugin features do I need to set in order to get my Jenkins job to trigger a build anytime code is committed to a SVN project? I have installed both the standard SVN plugin as well as the SVN tagging plugin but do not see any new features that allow trigger configuration.

NOTE:
Please post your answers in Comments box

Jenkins CI configuration: Build/test/deploy scenarios

My goal: set up a Jenkins-server capable of pulling down our github repos and run through the build-deploy-test scenarios.
So I have set up a Jenkins-server. But I don't understand how I have to run through the build-deploy-test scenarios of my project.
My project contains 1 repository which I putted into a job. I have installed the Build Pipeline Plugin. Will this be enough? It's difficult for me to understand the set-up. How do I have to start?

NOTE:
Please post your answers in Comments Box