aboutsummaryrefslogtreecommitdiff

Simple CI

The simplest pseudo-Continuous Integration tool I could conceive

This does not have a web UI This does not have error reporting This does not require docker

This is just a script which is intended to be run by cron, or some other mechanism, and it will just check a git repository, update if there's a change, and then run a command within this directory.

This can be a deployment command (making this a CD, not CI) or it can be kicking off a test suite, or it can be whatever you want.

The reason

I have a small VPS, I wanted it to deploy a static site when I pushed a change to a live branch. I could have used a post-receive hook on the server, but the repository is currently within a docker container, something I intend to change at some point. I am sure I could change it, but I just wanted a solution. I couldn't find anything that just did the bare minimum I wanted without bells and whistles, so I wrote one.

Configuration

Within simpleci.sh there are two variables: * JOB_DIR - sets the location for jobs * WORKSPACE_DIR - sets the location that simpleci will use for local copies

These default to being 'jobs' and 'workspaces' within the simpleci directory, but can be changed.

Jobs

Jobs are names of projects which can be run. These are stored within JOB_DIR. These are a simple file with up to three pieces of information: * REPO - the repository to monitor * BRANCH - the branch to monitor [live] * COMMAND - the command to run within the directory [make publish]

Running

It is possible to run simpleci manually /path/to/simpleci.sh - this will check for any updates in any of the jobs, and run them where required /path/to/simpleci.sh JOB1 [JOB1 [JOB3 ..]]. - this will force-run specific jobs, regardless if there is an update or not.

The job names are the filenames within JOB_DIR. eg /path/to/simpleci.sh example

It is also possible to add to cron to run it periodically. eg */30 * * * * /path/to/simpleci.sh >> /path/to/simpleci.log 2>&1