Executing a shell script as another user in JENKINS-CI

Recently i came accross a problem with jenkins to run a script as another user (you know because only some users can access/remove/create files)

Here is one, hopefully secured enough, solution, that i ran using ubuntu (should be very similar in other linux systems):

1. Create a custom password for jenkins user
sudo passwd jenkins

2. Add jenkins to sudoers list
sudo nano /etc/sudoer and add one line
jenkins ALL=(ALL) ALL

3. Create a file with the jenkins password inside and limit read access only to jenkins user
sudo su - jenkins
echo 'the_jenkins_password' > pwd
chmod 600 pwd

4. Execute your script
In your custom build create a free form build and select “Execute Shell” in build steps and in the box do:
cat /var/lib/jenkins/pwd | sudo -S su - another_user_name -c "sh /path/to/your/script.sh"

Et voila, your script start as your user name!


Productivity tools for successful developer

If you want to start a project, you really want to grab the best tools around to increase your productivity. Of course with time it is changing. Some tools will appear, others will disappear or deprecate.

Here is my contribution in the java world, more specifically Grails/Groovy and using only free tools

  • IDE

Well, that one you probably know, this is the war between Eclipse and Netbeans. Personally, I always change every year… Now i am on Eclipse, especially Springsource Tool Suite (STS 2.7 currently), with greate support for groovy/grails

  • Source Repository

I am using GIT on github (http://github.com) and this is really a must-use. Coming from SVN world, moving to git makes me a huge step in productivity. Favorite command: “git mv” and “git rm”. Note that github gives you free open-source repositories. I strongly advice to have a look to this reference article on how to manage your git repository (aka gitflow): http://nvie.com/posts/a-successful-git-branching-model/. Alternatively, but not tried, and sounds very similar, you may go for bitbucket https://bitbucket.org/.

  • Continous Integration (CI)

If you want to streamline your development from the creation of the project to the release on the website, you must use hudson/jenkins (preference for http://jenkins-ci.org/, since oracle seems to screw up the whole java OS ecosystem). This is your heartbeat system monitoring, for source repository checking, release, testing. With a bit of work, it will simplify your chores and let you focus on the only interesting part of development: fun.

  • Agile

I have tried many tools, but the one that really striked me is PivotalTracker:  https://www.pivotaltracker.com. This is based on kanban technology. This is really efficient and much more motivating than a simple task manager. And Pivotal Tracker has the same business model as github: free for os project, 5 private projects when you are alone.

  • Screencast

Want to make screenscasts, but without hassles. Tired to prepare soft, save screencast, convert to some format, check if quality has not been lost in the between, upload it to some website and blabla… Welcome http://www.screenr.com/. Just press the button on the website, no install, and start recording. Be sure to have latest version of java installed. Everything is sleek and seamlessly uploaded on the website. And this is free for public screencasts… If you find something better, let me know!

  • Hosting

When your app is ready to go, or just want to have a proof of concept of your OS project online, then go for Integrated Cloud solutions. I have been really happy with http://www.cloudfoundry.com. There is a big potential, above with the release of their system to create your own private cloud and test platform. Still in beta so prices are not know, but they will most probably be similar to direct concurrent like http://www.cloudbees.com/: free plans for OS projects.

  • Conclusion

Well you have all of them here. I may update later this post with few things if i think they are important. Now you have to bridge them all! Stay tuned, this will be for later…

Events-calendar grails plugin released

I am really happy to announce the release of the events-calendar plugin for grails.

So far this is version 1.0RC1

This plugin is dedicated to give grails framework the capabilities to manage calendars. There is also an application acting as a proof of concept to show integration with spring-security-acl plugin. Check it out on cloudfoundry.com: http://calendar.cloudfoundry.com, source code on github.

Many thanks to Martin Dow for initiating the plugin. Thanks also to the cloudfoundry team for letting me to try out the beta version of their PaaS. More on this awesome tool later.

Let me know what you think.

Hello world!

Welcome to my new blog.

def arrayOfInterest =['groovy', 'grails', 'music', 'and', 'so', 'on']
arrayOfInterest.each{tag ->

Stay tuned content will be coming soon.