Ciinabox2 EC2 Agent Build Caching

Jenkins Agent Build Caching

With the latest ciinabox2 0.8.0 and the latest ciinabox Jenkins agent AMIs releases Jenkins agents can now mount a EFS volume to cache build data. This can provide a performance boost with builds pulling in large amount of dependencies or cloning large repositories.

To setup the cache volume on the EC2 agent follow these steps:

  1. add the initScript key to your EC2 plugin configuration with the mount command using the new cache EFS access point to the /efs/cache directory

    - amazonEC2:
        cloudName: "linux"
        - ami: "${/ciinabox/ci2/agent/linux/ami}"
            initScript: |
                sudo mount -t efs -o tls,accesspoint=${/ciinabox/ci2/agent/cache-ap} ${/ciinabox/ci2/agent/efs} /efs/cache
  2. setup your pipeline to utilise the cache directory

    pipeline {
        agent {
            label 'linux'
        stages {
            stage('build') {
                steps {
                    dir('/efs/cache') {
                        sh 'pwd'

Ciinabox 0.8.0 Improvements

The 0.8.0 release has some additional bug fixes:

Latest Jenkins EC2 Agent Improvements