/azureblob-build-cache

An Azure Blob Storage Gradle Build Cache implementation

Primary LanguageJavaApache License 2.0Apache-2.0

azureblob-build-cache

Apache License 2.0 Build Status Quality Gate Status Coverage

This is a Gradle build cache implementation that uses the Azure Blob Storage as a storage backend for cache objects. It is inspired by the S3 Build Cache Plugin.

Usage

This plugin has not been used in production for any serious project. Feedback is very welcome. Feel free to open an issue if you find a bug or have an idea for improvement. Even better, open up a PR with the desired change!

Applying the plugin

You can get the latest version from the Gradle Plugin Portal. Add the following to your settings.gradle to apply the plugin:

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"        
        }
    }
    dependencies {
        classpath "de.timmhirsens.azureblobcache:azureblob-build-cache:0.0.1"
    }
}

apply plugin: 'de.timmhirsens.azureblobcache.caching'

Configuration

The following configuration settings are required for using this plugin.

Configuration Key Description Required?
container The name of the container in Azure Blob Storage where cache objects should be stored yes
accountName The account name to use for storing the objects yes
accountKey The account key for the account name (keep this secret) no (the azure blob storage container has to be configured accordingly)

An configuration may look like this:

ext.isCiServer = System.getenv().containsKey("CI")
buildCache {
    local {
        enabled = !isCiServer
    }
    remote(de.timmhirsens.azureblobcache.AzureBlobStorageBuildCache) {
        container = 'cache'
        push = isCiServer
        accountName = "youraccountname"
        accountKey = "gsafdzgfizdgwizgewzgfzewugzewuz/sfwe3223442sdfs/fdsojfiodsuzfewfhewuig=="
    }
}

You can read more about Gradle Build Cache on the Grade website

Expiring cache entries

This plugin does not expire cache entries. You can use the Blob Storage Lifecycle Management for this.

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.