Git Product home page Git Product logo

buildkite-gradle-plugin's Introduction

Buildkite Gradle Plugin

Build Status GitHub tag (latest SemVer)

A Gradle plugin that provides a DSL for dynamically generating Buildkite pipelines.

Made with ❤️ by Widen.

Installation

First add the plugin to your project:

plugins {
    id 'com.widen.buildkite' version '0.4.0'
}

Check out the releases page for a list of versions and the changelog for each. Now you are ready to start defining Buildkite pipelines using Groovy inside your build.gradle!

Configuration

Below is an example of defining a Buildkite pipeline:

buildkite {
    pipeline('deployStage') {
        def regions = ['us-east-1', 'eu-west-1']

        regions.each { region ->
            commandStep {
                label ":rocket: Deploy app to stage $region"
                command "./bksh deploy-helm-2 -r app-stage -f app-stage-${region}.yaml -g \${DOCKER_TAG} -k k8s2-stage-$region -v 4.2.3"
                agentQueue 'deploy-stage', region
            }
            commandStep {
                label ":sleeping: Wait for stage $region deploy to finish"
                command "./bksh wait-for-deploy http://app.${region}.widen-stage.com/health"
                agentQueue 'deploy-stage', region
            }
        }

        waitStep()

        regions.each { region ->
            commandStep {
                label ":smoking: Integration test the stage $region deployment"
                command "./gradlew app-app:integrationTest -Dapp.endpoint=http://app.${region}.widen-stage.com --continue \${GRADLE_SWITCHES}"
                branch 'master'
                agentQueue 'integ-stage', region
                dockerCompose {
                    run 'gradle'
                }
            }
        }
    }
}

A Gradle task named uploadDeployStagePipeline will be created automatically. Running this Gradle task locally spits out the JSON representation, so you can see if your pipeline looks correct. Inside Buildkite the pipeline will be added to the current build.

You can also define your pipelines inside Gradle files in a .buildkite directory matching the pattern pipeline*.gradle. These files will be loaded and evaluated inside the pipeline context automatically (unless buildkite.includeScripts is set to false). The name of the pipeline is determined from the file name automatically; pipeline.{name}.gradle becomes the camelCase version of {name}, while pipeline.gradle is named default. See pipeline.extra-steps.gradle for an example of this.

This example demonstrates the power of using a language like Groovy to dynamically generate a pipeline based on lists or other dynamic code. You could even parallelize your unit tests by generating a separate step for each subproject reported by Gradle! Check out the plugin's own pipeline for more examples.

Tasks

Aside from the upload{name}Pipeline tasks created, a pipelines task is also provided that lists the names of all pipelines found in the project.

License

Available under the Apache-2.0 license. See the license file for details.

buildkite-gradle-plugin's People

Contributors

sagebind 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.