Continuous integration/grunt

grunt is a task based command line tool for Node.js, just like ant for java or rake for ruby. The Wikimedia continuous integration team is going to use that to streamline the build tasks in Jenkins jobs.

Grunt is usually installed using the node package management (npm) system. That will get the source file from an upstream repository and happily copy everything on your server. Since we do not trust upstream authors, we are maintaining our own copy of grunt and its required dependencies in a Gerrit hosted repository: integration/gruntjs.git

Updating
We are updating grunt upstream by just squashing all changes from upstream in our repository then update the node-modules locally add the resulting update to our git repository.

Setup a local repository with upstream and wikimedia repository:

mkdir ~/project/integration/gruntjs cd ~/project/integration/gruntjs git review -s # Sets up 'gerrit' remote git remote rm origin git remote add upstream https://github.com/gruntjs/grunt.git git remote update git checkout master git branch --set-upstream-to gerrit/master master

The master branches from each remote do not relate to each other. The wikimedia one has been created as an orphan branch and is used as a receptacle for a squashed merge of upstream changes. To update the Wikimedia copy:

git checkout master git rm -r * git checkout upstream/master -- * git commit
 * 1) Get yourself to the Wikimedia copy
 * 1) Clear out local files
 * 1) Replace with latest version of upstream
 * 1) Write a nice commit summary:

For example: gruntjs 0.4.0 (fc956fa002)

From upstream: https://github.com/gruntjs/grunt.git

Now you want to remove the existing node_modules and do a clean install:

rm -rf node_modules/ npm install edit .gitignore git add .gitignore node_modules/ git commit -m "NPM dependencies for gruntjs 0.4.0"
 * 1) Install all grunt dependencies locally
 * 1) Remove  `node_modules` entry
 * 1) Commit

Send the update to Gerrit for review:

git push gerrit HEAD:refs/for/master/upstream