DEV@cloud » Build Tools » Custom Build Tools

Custom Build Tools

Last modified by Patrick Tsai on 2012/04/01 07:13

Requirement

You have some custom software / scripts ("tools") that are (logically or physically) separate to your main software. You need these tools to be available in your build, however do not want them checked-in with your main build (for repository bloat / change-control / neatness reasons).

If the size of the tool is low/moderate compared to the overall size of your build; then checking them (update or full clone) on each build is the simplest way to approach the problem. If you are planning on using this tool across a large number of builds, then you may have to consider erasing the tool from your workspace at the end of the job.

In Job Checkout - Small Build Tools

For example, if you have a CloudBees Git repository (as an example), you could create a repository dedicated to the tool and manage it separately there.

set -eu
cd $WORKSPACE
TOOL_NAME=custom-tool
TOOL_REPO=git@git.cloudbees.com/<account>/${TOOL_NAME}
if [ -d "${TOOL_HOME}" ]; then
  
cd "${TOOL_NAME}"
  git pull origin master
else
  
git clone ${TOOL_REPO} ${TOOL_NAME}
fi

Out of Job Checkout - Large Build Tools

If the size of your build tool is quite large (i.e. GBs), then it is possible to move the tool into a separate job and rely on the workspace caching to deliver the tool into a directory relative to your running job.

$WORKSPACE/../${TOOL_NAME}

However this is NOT supported, and may break in the future when workspace caching is changed.

While some of our build add-ons work this way (PostgreSQL / RVM); you should not copy this as the add-ons technique will likely be deprecated (in its current form) when workspace caching is upgraded. 

Private repository

You can also use your private repository on forge to store custom build tools. Each DEV@Cloud account has a standard private WebDAV repository for storing arbitrary files. This files are mounted on executors under /private/<account-id> and are accessible to any job in your account. Please note this is mounted read-only, so you can't modify any file from a job.

To upload files to this repository you need to connect with a WebDAV client to https://repository-{account-id}.forge.cloudbees.com/private/ using your CloudBees username based credentials (i.e. username / password - not email / password).

Because this repository is exposed over webdav, you and all of your developers can mount it as a webdav drive, allowing you to interact with it just like a local drive (drag and drop operations, etc).  How to mount this depends on your operating system, but here are some pointers on how to do this:

From your job, you can then invoke custom build tools as /private/<account-id>/whatever-you-have-installed

Tags:
Created by Ben Walding on 2011/07/19 23:39