Translate

Showing posts with label Atlassian. Show all posts
Showing posts with label Atlassian. Show all posts

August 30, 2013

Git username and password

The challenge

I come across a common problem when working with Git. I am a consultant and working on different projects. This means that I do have multiple Git repository to commit to. All of them have some kind of user recognition in a web GUI. This means that the web scans the commit for the user's name and email address to check against its users and find the correct one. This will resolve, for example, into a profile picture beside the commits. As, amongst others, Atlassian Stash does.
There are multiple solution to set your name and email depending on the client you use but it is cumbersome at best.

The solution

There is a very simple and easy solution. As Git allows settings per repository, you can define a name and email for each of them. After navigating to the repository you want to configure, write:
 git config --local user.email "your@email.com"  
 git config --local user.name "Your Name"  

You may also want to set a "default" settings for new repositories. To do so, you can use the --global instead of --local
 git config --global user.email "your@email.com"  
 git config --global user.name "Your Name"  

This will set these settings for your user. You can even go further and set it with the --system. This will be active for all users on this computer

July 30, 2013

Auto build PrimeFaces from source with Bamboo

How to use the latest version of PrimeFaces in your projects

Building from source in Bamboo

Background

A little while back, we wanted to use the latest version of Primefaces where some bugs where fixed but the built library was not available so we decided to build from source. It is quite easy to do manually but we wanted to automate the process. So what we did was to add a build in our CI: Bamboo. We have an internal maven repository (Nexus).
We want to be able to add PrimeFaces SNAPSHOTS to our projects

Original setup

We have Nexus installed and it is defined in our settings.xml so we can access our own builds. In addition, we have a Bamboo server (this setup should work with other CI).

Requirement

On the Bamboo server, you need to have perl installed and added as an executable in the Bamboo admin

The build

  1. You need to define the repository. For now, it is http://primefaces.googlecode.com/svn/primefaces/trunk/ I add it as a shared repository in Bamboo but it is not necessary. You can define it in the plan.
  2. Add the checkout task - no special configuration here
  3. Here is the trick: we need to replace the distributionManagement tag to deploy it to our own repository. This is done with perl. Create a "Command" task with the perl executable and add these argiment: -pi -e 'BEGIN{undef $/;} s/.*<\/distributionManagement>/your-distributionManagement-tag-goes-here/smg' pom.xml
    Note that all forward slash "/" needs to be escaped with a backslah i.e: http:\/\/www.repo.com\/path\/to\/repo
  4. Next, you create a maven task that runs clean deploy

That's it

Now you are ready to go with the newest PrimeFaces available in your projects. As a side note, I added a trigger to run this plan every week only if new code has been commited.

For more information

You can contact us at OSnode.