Kohei Nozaki's blog 

Configuring automatic build by push for git repository


Posted on Sunday Mar 01, 2015 at 07:15PM in Jenkins


We can start the build by send request to following URL.

http://YOURHOST/jenkins/job/PROJECTNAME/build

Recipe

In my case, Jenkins is deployed in /, and the server is running on port 18080. so the command to start a build of the job named trader will be:

curl http://localhost:18080/job/trader/build

So put following shell script into $ORIGIN_BARE_REPOSITORY/hooks/post-receive and execute chmod +x post-receive.

#!/bin/sh
curl http://localhost:18080/job/trader/build

Testing

Push some modification as follows:

$ echo hook test >> hi.txt
$ git add hi.txt
$ git commit -m 'hook test'
$ git push origin master

Check the build was run automatically as expected, and the output.

b0731e82 30d0 4638 b412 1e1bba91d3c9


Creating a simplest Jenkins job against a git repository


Posted on Sunday Mar 01, 2015 at 05:45PM in Jenkins


  1. Click New Item

    ecdf88ac ba06 4f30 aaa6 889b72d7a6be
  2. Enter trader in Item name and select Build a free-style software project

    81952af0 a4ae 40d7 a387 e02647d31f23
  3. Select Git and enter Repository URL

    9ac2c2af 2a4a 4b4d 90b4 7eed0a73433e
  4. Click Add build step - Execute shell

    dc7e02f0 9e6f 47ed 8049 e7a1a3078c11
  5. Enter cat hi.txt into Command

    95537b80 e9a0 4e42 89df d8dfb548de90
  6. Click Save

    659ed88d 0455 400c 91e4 f4b3ab714ea3
  7. Click Build Now

    9d4ef446 7b26 4a7a a2a2 010268e05e84
  8. Click a Build History which just created by build

    44f32959 4d18 4a89 8895 c35c1861be51
  9. Click Console Output

    f3da0b60 f9a2 4963 a12f 4fc3a8c1f392


Creating a shared git repository on local filesystem


Posted on Sunday Mar 01, 2015 at 05:04PM in Git


Tested with OS X 10.9.5.

Requirement

There are 2 users (kyle and jenkins). they want to have a shared git repository named trader on local filesystem. both of them can push changes into the repository.

Recipe

  1. Create a group named trader

    $ sudo dseditgroup -o create trader
  2. Let join kyle nad jenkins into the group trader

    $ sudo dseditgroup -o edit -a kyle -t user trader
    $ sudo dseditgroup -o edit -a jenkins -t user trader
  3. Create a bare repository

    $ cd /Users/Shared
    $ mkdir trader.git
    $ cd trader.git
    $ git init --bare --shared
  4. Change owning group of trader.git to trader

    $ cd ../
    $ chown -R :trader trader.git
  5. Make the repository writable by users in trader group

    $ chmod -R g+w trader.git

Testing

  1. Clone the repository

    $ git clone /Users/Shared/trader.git
  2. Make first commit by kyle

    $ cd trader
    $ echo 'hi there' > hi.txt
    $ git add hi.txt
    $ git commit -m 'first commit from kyle'
  3. Push to the parent repository

    $ git push origin master
  4. Switch to user jenkins

    $ sudo su - jenkins
  5. Clone the repository

    $ git clone /Users/Shared/trader.git
  6. Make first commit by jenkins

    $ cd trader
    $ echo hi there from jenkins >> hi.txt
    $ git add hi.txt
    $ git commit -m 'first commit from jenkins'
  7. Push to the parent repository

    $ git push origin master
  8. Pull the change made by jenkins from user kyle

    $ whoami
    kyle
    $ cat hi.txt
    hi there
    $ git pull origin master
    $ cat hi.txt
    hi there
    hi there from jenkins



JBeret on Java SE with JDBC chunk oriented processing example


Posted on Saturday Feb 28, 2015 at 09:58PM in JBatch


I pushed an example to https://github.com/lbtc-xxx/jberet-se-example . but it looks like not comfortable due to lack of automatic injection mechanism or transaction management that available in EE environment. I guess some better approach might be exists but I don’t know yet. if you know any better way please let me know.