Code Monkey home page Code Monkey logo

oci-gradle-build-cache-plugin's Introduction

oci-gradle-build-cache-plugin

ASL2 Licensed Build Status Gradle Plugin Portal, link=


This is a custom Gradle build cache implementation which uses the Oracle Cloud to store the cache objects.

Warning
This plugin is not endorsed by Oracle nor does the company provide any support for it.

Prerequisites

  1. An Oracle Cloud account. Sign up for an Always Free tier account at http://oracle.com/cloud/free.

  2. A resource compartment. It’s recommended to use a compartment different from the default root.

  3. Setup an Object Lifecycle Policy on the compartment. Refer to https://docs.cloud.oracle.com/iaas/Content/Object/Tasks/usinglifecyclepolicies.htm

Gradle 6.x and Java 8 are the minimum requirements to run this plugin.

Usage

Add the following to your settings.gradle file

buildscript {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath 'org.kordamp.gradle:oci-gradle-build-cache-plugin:0.10.0'
    }
}

apply plugin: 'org.kordamp.gradle.oci-build-cache'

Configuration

Add the following to your settings.gradle file

ext.isCiServer = System.getenv().containsKey('CI')

buildCache {
    local {
        enabled = !isCiServer
    }
    remote(org.kordamp.gradle.plugin.buildcache.OCIBuildCache) {
        compartmentId = <compartment-id>
        push = isCiServer
    }
}

The plugin offers the following configuration properties

Configuration Key Description Mandatory Default Value

configFile

Location of the config file

no

~/.oci/config

profile

Name of the OCI profile to use

no

DEFAULT

compartmentId

Compartment that owns the bucket

yes

bucket

Bucket name

no

build-cache

policy

Object lifecycle policy (DELETE)

no

amount: 30L, unit: days

failOnError

Fail the build on config error

no

true

The default object lifecycle policy is to delete cached items after 30 days. You can change these defaults with the following snippet

settings.gradle
buildCache {
    local {
        enabled = !isCiServer
    }
    remote(org.kordamp.gradle.plugin.buildcache.OCIBuildCache) {
        compartmentId = <compartment-id>
        push = isCiServer
        policy {
            amount = 90L // 3 months
        }
    }
}

You can configure authentication in two ways:

  1. Using the standard configuration file, typically located at ~/.oci/config.

  2. Defining a config block on the remote block.

Standard Config File

The format of the configuration file is specified at this page, it looks something similar to

~/.oci/config
[DEFAULT]
user=ocid1.user.oc1...
tenancy=ocid1.tenancy.oc1...
region=eu-frankfurt-1
key_file=~/.oci/oci_api_key.pem
pass_phrase=<secret>
fingerprint=f9:14:d0:...

Config Block

Alternatively you may define a config block. This block defines properties that match settings found on the config file

settings.gradle
buildCache {
    local {
        enabled = !isCiServer
    }
    remote(org.kordamp.gradle.plugin.buildcache.OCIBuildCache) {
        compartmentId = <compartment-id>
        bucket = <bucket-name>
        push = isCiServer
        config {
            userId      = 'ocid1.user.oc1...'
            tenantId    = 'ocid1.tenancy.oc1...'
            region      = 'eu-frankfurt-1'
            keyfile     = '~/.oci/oci_api_key.pem'
            passphrase  = '<secret>'
            fingerprint = 'f9:14:d0:...'
        }
    }
}

More details about configuring the Gradle build cache can be found in the official Gradle documentation.

oci-gradle-build-cache-plugin's People

Contributors

aalmiray avatar github-actions[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.